Пример #1
0
 private static void ValidateStructSize <T>(Native_SizeOfStruct.Del_SizeOf func) where T : struct
 {
     if (func != null)
     {
         ValidateStructSize <T>(func, Marshal.SizeOf <T>());
     }
 }
Пример #2
0
        private static void ValidateStructSize <T>(Native_SizeOfStruct.Del_SizeOf func, int managedSize) where T : struct
        {
            int nativeSize = func();

            if (managedSize != nativeSize)
            {
                string error = string.Format("Struct size mismatch on '{0}' managed:{1} native:{2}", typeof(T), managedSize, nativeSize);
                FMessage.Log(ELogVerbosity.Error, error);
                System.Diagnostics.Debug.WriteLine(error);
                System.Diagnostics.Debug.Assert(false, error);
            }
        }