本文整理汇总了C#中Class2.F1方法的典型用法代码示例。如果您正苦于以下问题:C# Class2.F1方法的具体用法?C# Class2.F1怎么用?C# Class2.F1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Class2
的用法示例。
在下文中一共展示了Class2.F1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main() {
Class1 obj1=new Class1();
CheckReturnedInt(obj1.F1("obj1"), 1);
CheckReturnedString(obj1.F2("obj1"), "String returned from Class1.F2:obj1");
CheckReturnedString(obj1.NonVirtualFunc(11), "String returned from Class1.NonVirtualFunc:11");
Console.WriteLine("");
Class2 obj2=new Class2();
CheckReturnedInt(obj2.F1("obj2"), 2);
CheckReturnedString(obj2.F2("obj2"), "String returned from Class2.F2:obj2");
CheckReturnedString(obj2.NonVirtualFunc(15), "String returned from Class2.NonVirtualFunc:30");
Console.WriteLine("");
I1 itf;
itf = obj1;
CheckReturnedInt(itf.F1("itf is now obj1"), 1);
CheckReturnedString(itf.F2("itf is now obj1"), "String returned from Class1.F2:itf is now obj1");
Console.WriteLine("");
itf = obj2;
CheckReturnedInt(itf.F1("itf is now obj2"), 2);
CheckReturnedString(itf.F2("itf is now obj2"), "String returned from Class2.F2:itf is now obj2");
Console.WriteLine("");
if (failed) {
System.Environment.ExitCode = 1;
}
else {
System.Environment.ExitCode = 0;
}
}