private byte[] CollectionToArray(System.Collections.Generic.List<byte> list) { byte[] retval = new byte[list.Count]; int i = 0; try { foreach (byte b in list) { retval[i++] = b; } } catch (Exception) { } return retval; }