CSharp examples for System:Array Null Element
Decodes the buffer using the specified encoding, stopping at the first null
using System.Text; using System.Collections.Generic; using System;//from w w w .j a v a2 s. c o m public class Main{ /// <summary> /// Decodes the buffer using the specified encoding, stopping at the first null /// </summary> public static string DecodeAsString(byte[] buffer, int offset, int length, Encoding encoding) { for (int n = 0; n < length; n++) { if (buffer[offset + n] == 0) length = n; } return encoding.GetString(buffer, offset, length); } }