잊지 않겠습니다.

4. Variance

.NET Framework 2009. 1. 7. 12:57

IEnumerable interface의 변경 

  1. public interface IEnumerable<out T> : IEnumerable  
  2. {  
  3.     IEnumerator<T> GetEnumerator();  
  4. }  
  5.   
  6. public interface IEnumerator<out T> : IEnumerator  
  7. {  
  8.     bool MoveNext();  
  9.     T Current { get; }  
  10. }  

 : out의 추가. 모든 결과의 output만이 가능한 상태로 interface의 변경

 

IComparer interface의 변경

  1. public interface IComparer<in T>  
  2. {  
  3.     public int Compare(T left, T right);  
  4. }  

각 Interface에서의 in, out의 명시적 사용이 된 형태로 interface 변경

Posted by Y2K
,