public static int Main() { int iRetVal = 100; var rF = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f); var rD = new RectangleD(1.7E+3d, 4.5d, 500.1d, 60.0d); var rI = new RectangleI(100, -2, 3, 64); var rLSmall = new RectangleLSmall(11231L); var rLLarge = new RectangleLLarge(1L, 20041L, 22L, 88L); var rNestedFSmall = new RectangleNestedF(1.2f, 3.4f, 5.6f, 7.8f); typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffF").Invoke(null, new object[] { rF }); typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffD").Invoke(null, new object[] { rD }); typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffI").Invoke(null, new object[] { rI }); typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffLSmall").Invoke(null, new object[] { rLSmall }); typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffLLarge").Invoke(null, new object[] { rLLarge }); typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffNestedF").Invoke(null, new object[] { rNestedFSmall }); if (!RectangleF.Equals(ref passedFloatStruct, ref rF)) { TestLibrary.Logging.WriteLine($"Error: passing struct with floats via reflection. Callee received {passedFloatStruct} instead of {rF}"); iRetVal = 0; } if (!RectangleD.Equals(ref passedDoubleStruct, ref rD)) { TestLibrary.Logging.WriteLine($"Error: passing struct with doubles via reflection. Callee received {passedDoubleStruct} instead of {rD}"); iRetVal = 1; } if (!RectangleI.Equals(ref passedIntStruct, ref rI)) { TestLibrary.Logging.WriteLine($"Error: passing struct with ints via reflection. Callee received {passedIntStruct} instead of {rI}"); iRetVal = 2; } if (!RectangleLSmall.Equals(ref passedLongSmallStruct, ref rLSmall)) { TestLibrary.Logging.WriteLine($"Error: passing struct with a long via reflection. Callee received {passedLongSmallStruct} instead of {rLSmall}"); iRetVal = 3; } if (!RectangleLLarge.Equals(ref passedLongLargeStruct, ref rLLarge)) { TestLibrary.Logging.WriteLine($"Error: passing struct with longs via reflection. Callee received {passedLongLargeStruct} instead of {rLLarge}"); iRetVal = 4; } if (!RectangleNestedF.Equals(ref passedNestedSmallFStruct, ref rNestedFSmall)) { TestLibrary.Logging.WriteLine($"Error: passing struct with longs via reflection. Callee received {passedNestedSmallFStruct} instead of {rNestedFSmall}"); iRetVal = 5; } return iRetVal; }
public static void DoStuffLLarge(RectangleLLarge r) { passedLongLargeStruct = r; }
public static bool Equals(ref RectangleLLarge r1, ref RectangleLLarge r2) { return (r2._x == r1._x) && (r2._y == r1._y) && (r2._width == r1._width) && (r2._height == r1._height); }