This class contains extension methods that are provided as part of various Loyc.Collections interfaces. For example, it provides methods such as IndexOf(), Contains() and CopyTo(), that the traditional ICollection{T} and IList{T} interfaces require the author to write himself.
For covariant collections such as ISource{T} and , the CLR actually prohibits methods such as Contains(T) and IndexOf(T), because T is not allowed in "input" positions. Therefore, these extension methods must be used to fill the gap. Even methods such as bool TryGet(int, out T) are prohibited, so TryGet() has the signature T TryGet(ref bool failed) instead, and extension methods provide the original version of the method in addition.
示例#1
0
 public void CopyTo(T[] array, int arrayIndex)
 {
     LCInterfaces.CopyTo(_obj, array, arrayIndex);
 }
示例#2
0
 public void CopyTo(V[] array, int arrayIndex)
 {
     LCInterfaces.CopyTo(this, array, arrayIndex);
 }
示例#3
0
 public bool Contains(T item)
 {
     return(LCInterfaces.Contains(this, item));
 }
示例#4
0
 void ICollection <T> .CopyTo(T[] array, int arrayIndex)
 {
     LCInterfaces.CopyTo(this, array, arrayIndex);
 }
示例#5
0
 public int IndexOf(T item)
 {
     return(LCInterfaces.IndexOf(this, item));
 }