You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
606 B
C#
28 lines
606 B
C#
3 weeks ago
|
//Shady
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
public static class ListUtility
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Method returns the First element of the List.
|
||
|
/// </summary>
|
||
|
public static T First<T>(this List<T> list)
|
||
|
{
|
||
|
if(list.Count > 0)
|
||
|
return list[0];
|
||
|
|
||
|
return default(T);
|
||
|
}//Last() end
|
||
|
|
||
|
/// <summary>
|
||
|
/// Method returns the Last element of the List.
|
||
|
/// </summary>
|
||
|
public static T Last<T>(this List<T> list)
|
||
|
{
|
||
|
if(list.Count > 0)
|
||
|
return list[list.Count - 1];
|
||
|
|
||
|
return default(T);
|
||
|
}//Last() end
|
||
|
|
||
|
}//class end
|