public static int GetSizeConst(MemberInfox property) { var att = property.GetCustomAttributes(typeof(MarshalAsAttribute)) as MarshalAsAttribute; if (att == null) return -1; return att.SizeConst; }
private bool IsEqualDefaut(MemberInfox property) { try { if (!Utility.IsSimpleType(property.ValueType)) return false; var val = property.GetValue(); object att = property.GetCustomAttributes(typeof(DefaultValueAttribute)); if (att != null) return object.Equals(val, (att as DefaultValueAttribute).Value); return object.Equals(val, Utility.GetDefault(property.MemberType)); } catch { } return true; }