EnumerableComCollection<TComEnumerator, TEnumerated> Class
Provides a generic base class for types that provide an IEnumerable wrapper around COM-style IEnumXXX interfaces.
Assembly: Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)
Microsoft.VisualStudio.Shell.EnumerableComCollection<TComEnumerator, TEnumerated>
Microsoft.VisualStudio.Shell.EnumerableHierarchiesCollection
| Name | Description | |
|---|---|---|
![]() | EnumerableComCollection<TComEnumerator, TEnumerated>(TComEnumerator) | Initializes a new instance of EnumerableComCollection<TComEnumerator, TEnumerated> for the provided enumerator. |
![]() | EnumerableComCollection<TComEnumerator, TEnumerated>(TComEnumerator, Int32) | Initializes a new instance of EnumerableComCollection<TComEnumerator, TEnumerated> for the provided enumerator and cache size. |
| Name | Description | |
|---|---|---|
![]() | Clone(TComEnumerator, TComEnumerator) | Clones the item with the specified enumerator . |
![]() | Equals(Object) | (Inherited from Object.) |
![]() | Finalize() | (Inherited from Object.) |
![]() | GetEnumerator() | Gets the enumerator. |
![]() | GetHashCode() | (Inherited from Object.) |
![]() | GetType() | (Inherited from Object.) |
![]() | MemberwiseClone() | (Inherited from Object.) |
![]() | NextItems(TComEnumerator, UInt32, TEnumerated[], UInt32) | Gets the specified number of items. |
![]() | Reset(TComEnumerator) | Resets the counter of the collection. |
![]() | Skip(TComEnumerator, UInt32) | Skips the specified number of items. |
![]() | ToString() | (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | DefaultCacheSize | The default cache size. |
| Name | Description | |
|---|---|---|
![]() ![]() | IEnumerable.GetEnumerator() | Gets the enumerator. |
Classes that derive from this class change a COM-style IEnumXXX interface into a form that can be processed by a foreach statement. You must derive a separate class from this base class due to the way C# generics are defined.
This class must call methods on the COM enumerator that it wraps (Next(), Skip(), etc.), but generic types can access properties and methods only on the parameterized types that are specified in the their constraints. For example, you can call TComEnumerator.Next() only if you specify a constraint on TComEnumerator that tells the compiler that the type implements Next().
COM IEnumXXX interfaces are strongly typed. In other words, the IEnumXXX.Next() method returns an array of XXX objects. Because these interfaces do not have a common base interface, you cannot place a constraint on TComEnumerator directly. You can solve this problem by implementing the IComEnumeratorRelay<TComEnumerator, TEnumerated> interface along with the EnumerableComCollection<TComEnumerator, TEnumerated> interface. Doing so allows the generic type to call into the COM enumerator without having to place a constraint on TComEnumerator.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.





