CSharp examples for System:Byte Array
Pad Left byte array
using System.Text; using System.Collections.Generic; using System;//w w w. j a v a 2 s . c om public class Main{ public static byte[] PadLeft(this byte[] bytes, int length, byte value = 0) { int count = length; if (bytes != null) count = length - bytes.Length; var buf = new List<byte>(); while (count-- > 0) { buf.Add(value); } buf.AddRange(bytes); return buf.ToArray(); } }