private static T ConvertTo <T>(BytesType type) { if (type == null) { return(default(T)); } return(type.GetValue <T>()); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj is BytesType) { BytesType b1 = this; BytesType b2 = (BytesType)obj; if (b1._bigEndianValue != null && b2._bigEndianValue != null) { return(b1._bigEndianValue.SequenceEqual(b2._bigEndianValue)); } if (b1._sourceType != null && b2._sourceType == null) { b2.GetValue(b1._sourceType); } if (b2._sourceType != null && b1._sourceType == null) { b1.GetValue(b2._sourceType); } if (b1._value == null && b2._value == null && b1._bigEndianValue != null && b2._bigEndianValue != null) { b1.GetValue(typeof(byte[])); b2.GetValue(typeof(byte[])); } return(b1._value.SequenceEqual(b2._value)); } return(obj.Equals(GetValue(obj.GetType()))); }