环境:net framework 4.5.2


    1. Console.WriteLine(outString);
    2. dynamic a2 = new Test2() {
    3. ID = "3",
    4. };
    5. if (a2 is Test2 a3) {
    6. Console.WriteLine(a3.ID);
    7. }
    8. //对象一致(继承的子类也属于兼容类型),输出ID = 3