using System.Collections.Generic; public static class ListUtility { /// /// Method returns the First element of the List. /// public static T First(this List list) { if(list.Count > 0) return list[0]; return default(T); }//Last() end /// /// Method returns the Last element of the List. /// public static T Last(this List list) { if(list.Count > 0) return list[list.Count - 1]; return default(T); }//Last() end }//class end