CSharp examples for System.Collections:ICollection
First Or Default from ICollectionView
using System.ComponentModel; public class Main{ public static T FirstOrDefault<T>(this ICollectionView view) {//from ww w .j av a2 s . co m var enumerator = view.GetEnumerator(); if (enumerator.MoveNext()) return (T)enumerator.Current; else return default(T); } }