static void Main()
    {
        var myStruct = new MyStruct();

        Console.WriteLine(myStruct.i);          // prints 0
        Console.WriteLine(myStruct.ToString()); // modifies myStruct, not a copy of myStruct
        Console.WriteLine(myStruct.i);          // prints 1
    }
示例#2
0
        public void Run()
        {
            MyStruct s = new MyStruct();
            TestApi.WriteLine(s.GetType().ToString());
            TestApi.WriteLine(s.ToString());

            MyEnum e = MyEnum.Default;
            //TestApi.WriteLine(e.CompareTo(e).ToString());
            TestApi.WriteLine(e.GetTypeCode().ToString());
            TestApi.WriteLine(e.ToString());
        }
示例#3
0
 public override string ToString() => _field.ToString();
示例#4
0
文件: main.cs 项目: yukozh/coreclr
    static void TestConstrainedMethodCalls_Unsupported()
    {
        MyStruct s = new MyStruct();

        s.ToString();
    }
示例#5
0
文件: main.cs 项目: bjjones/coreclr
 static void TestConstrainedMethodCalls_Unsupported()
 {
     MyStruct s = new MyStruct();
     s.ToString();
 }