本文整理汇总了C#中TestClass.Sub方法的典型用法代码示例。如果您正苦于以下问题:C# TestClass.Sub方法的具体用法?C# TestClass.Sub怎么用?C# TestClass.Sub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestClass
的用法示例。
在下文中一共展示了TestClass.Sub方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static int Main(string[] a) {
try
{
int S = Sum( 5, 12.0, 6, 13.0f, __arglist());
if ( S == 36 )
Console.WriteLine("Test 1 passed");
else
{
Console.WriteLine("Test 1 failed !! Ret: " + S);
return 1;
}
} catch(Exception e)
{
Console.WriteLine("Test failed "+e);
return 1;
}
try
{
MyStruct st;
st.x = 123;
st.y = 434;
int S = Sum( 3, 1.0, 2, 8.0f, __arglist(5,st,"aaa",6) );
if ( S == 1573 )
Console.WriteLine("Test 2 passed");
else
{
Console.WriteLine("Test 2 failed !! Ret: " + S);
return 1;
}
} catch(Exception e)
{
Console.WriteLine("Test failed "+e);
return 1;
}
try
{
TestClass A = new TestClass();
int S = A.Sub( 9,7, __arglist() );
if ( S == 2 )
Console.WriteLine("Test 3 passed");
else
{
Console.WriteLine("Test 3 failed !! Ret: " + S);
return 1;
}
} catch(Exception e)
{
Console.WriteLine("Test failed "+e);
return 1;
}
try
{
TestClass A = new TestClass();
Struct1 s1;
s1.x = 43;
MyStruct S = A.SumAndCount( 9,7, __arglist(3,4,5,(byte)34,(short)45,
(long)123456789123456789L,(int)1,(long)123456789123456789L,(float)432,s1,(double)42) );
if ( S.x == 627 && S.y == 11 )
Console.WriteLine("Test 4 passed");
else
{
Console.WriteLine("Test 4 failed !! Ret: " + S.x + " " + S.y);
return 1;
}
} catch(Exception e)
{
Console.WriteLine("Test failed "+e);
return 1;
}
try
{
long sum = EnumTest(__arglist(
Enum1.EnumName1, Enum1.EnumName2, Enum8.EnumName8, Enum16.EnumName16,
Enuml.EnumNamel, Enum8.EnumName8, Enuml.EnumNamel));
if (sum == 246913578246926186)
Console.WriteLine("Test 5 passed");
else
{
Console.WriteLine("Test 5 failed !! Ret: " + sum);
return 1;
}
}
catch (Exception e)
{
Console.WriteLine("Test failed " + e);
return 1;
}
return 0;
}