xiaolizi007
12/17/2016 - 4:15 PM

how to use in , less use

泛型in out #csharp

ListOut:IList<out T>  
ListOut<int> lint=new ListOut<int>(){0,1,2};  
ListOut<Object> lobject=new ListOut<Object>();  
lobject=lint;  
 ListIn:IList<in T>  
ListIn<Object> lobject = new ListIn<Object>(){"0","1","2"};  
ListIn<int> lint=new ListIn<int>;  
lint = lobject;