private static FieldInfo GetDataStartField() { DataStartAttribute attr = typeof(T).GetCustomAttribute <DataStartAttribute>(); if (attr != null) { return(typeof(T).GetField(attr.FieldName)); } return(null); }
private static int GetStructDataOffset() { DataStartAttribute attr = typeof(T).GetCustomAttribute <DataStartAttribute>(); if (attr != null) { return(Marshal.OffsetOf(typeof(T), attr.FieldName).ToInt32()); } return(Marshal.SizeOf(typeof(T))); }