zoukankan      html  css  js  c++  java
  • C#4.0泛型中的out使用

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                B<string> b = new B<string>();
                b.TValue = "I'm B";
                Console.WriteLine(b.TValue);
                A<string> a = b;
                Console.WriteLine(a.TValue);
                A<object> a2 = b;
                Console.WriteLine(a2.TValue);

            }
        }

        interface A<out T>
        {
            T TValue
            {
                get;
            }
        }

        class B<T> : A<T>
        {
             public T TValue
            {
                get;
                set;
            }

        }


     


    }

  • 相关阅读:
    C# MATLAB混编(二)
    C# MATLAB混编(一)
    C#编程.循环的中断
    WPS 常用操作
    PowerDesigner 操作手册
    软件开发-零散问题
    代码优化
    layui 前端UI框架
    css 样式渲染
    linux 操作系统
  • 原文地址:https://www.cnblogs.com/kiminozo/p/1492171.html
Copyright © 2011-2022 走看看