Exemple #1
0
        private static void TestWrongPack()
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\n========================\n������ڴ���뷽ʽ:");
            Console.ResetColor();
            Console.WriteLine("�йܴ��붨��Ľṹ���ڷ��йܴ����еĴ�СΪ��{0}�ֽ�", Marshal.SizeOf(typeof(ManagedSimpleStruct_WrongPack)));
            ManagedSimpleStruct_WrongPack argStruct = new ManagedSimpleStruct_WrongPack();
            argStruct.intValue = 1;
            argStruct.shortValue = 2;
            argStruct.floatValue = 3.0f;
            argStruct.doubleValue = 4.5f;
            TestStructArgumentWrongPack(ref argStruct);

            Console.WriteLine("\n�ṹ�������ݣ�int = {0}, short = {1}, float = {2:f6}, double = {3:f6}",
                argStruct.intValue, argStruct.shortValue, argStruct.floatValue, argStruct.doubleValue);
        }
Exemple #2
0
 private static extern void TestStructArgumentWrongPack(ref ManagedSimpleStruct_WrongPack argStruct);