Last element in IList - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:IList

Description

Last element in IList

Demo Code


using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*  w  w  w .java  2 s  . c  o m*/

public class Main{
        public static T Last<T>(this IList<T> list)
        {
            return list[list.Count - 1];
        }
}

Related Tutorials