public static bool Deserialize <T>(this T val, byte[] data, int index = 0, int len = -1) { if (len == -1) { len = data.Length; } SdpReader reader = new SdpReader(data, (uint)index, (uint)len); return(reader.UnPack(ref val, 0)); }
public static T Deserialize <T>(byte[] data, int index = 0, int len = -1) { if (len == -1) { len = data.Length; } T val = Activator.CreateInstance <T>(); SdpReader reader = new SdpReader(data, (uint)index, (uint)len); if (reader.UnPack(ref val, 0)) { return(val); } return(default(T)); }