Exemple #1
0
        private static void TestStructArgumentVal()
        {
            ManagedSimpleStruct simpleStruct = new ManagedSimpleStruct();
            simpleStruct.intValue = 10;
            simpleStruct.shortValue = 20;
            simpleStruct.floatValue = 3.5f;
            simpleStruct.doubleValue = 6.8f;

            TestStructArgumentByVal(simpleStruct);

            Console.WriteLine("\n�ṹ�������ݣ�int = {0}, short = {1}, float = {2:f6}, double = {3:f6}",
                simpleStruct.intValue, simpleStruct.shortValue, simpleStruct.floatValue, simpleStruct.doubleValue);
        }
Exemple #2
0
        private static void TestCorrectPack()
        {
            Console.WriteLine("�йܴ��붨��Ľṹ���ڷ��йܴ����еĴ�СΪ��{0}�ֽ�", Marshal.SizeOf(typeof(ManagedSimpleStruct)));
            ManagedSimpleStruct argStruct = new ManagedSimpleStruct();
            argStruct.intValue = 1;
            argStruct.shortValue = 2;
            argStruct.floatValue = 3.0f;
            argStruct.doubleValue = 4.5f;
            TestStructArgumentByRef(ref argStruct);

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