CSharp examples for System.Collections.Generic:IEnumerable
Nullable First element from IEnumerable
using System.Linq; using System.Collections.Generic; using System;/*w w w . j a v a 2 s . c o m*/ public class Main{ public static T? NullableFirst<T>(this IEnumerable<T> sequence) where T : struct { return sequence.Select(e => (T?)e).FirstOrDefault(); } }