Beispiel #1
0
        private static FieldInfo GetDataStartField()
        {
            DataStartAttribute attr = typeof(T).GetCustomAttribute <DataStartAttribute>();

            if (attr != null)
            {
                return(typeof(T).GetField(attr.FieldName));
            }
            return(null);
        }
Beispiel #2
0
        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)));
        }