Share via


DependencyObjectCollection.First Method

Definition

Returns the iterator for iteration over the items in the collection.

public:
 virtual IIterator<DependencyObject ^> ^ First() = IIterable<DependencyObject ^>::First;
IIterator<DependencyObject> First();
public IIterator<DependencyObject> First();
function first()
Public Function First () As IIterator(Of DependencyObject)

Returns

The iterator object. The iterator's current position is at the 0-index position, or at the collection end if the collection is empty.

Implements

Remarks

You can iterate through a DependencyObjectCollection in C# or Microsoft Visual Basic. In many cases, such as using foreach syntax, the compiler does this casting for you and you won't need to cast to IEnumerable<DependencyObject> explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable with a DependencyObject constraint.

Applies to