Remove And Get from IList - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:IList

Description

Remove And Get from IList

Demo Code


using System.Reflection;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*from w w  w .ja v a  2 s .co  m*/

public class Main{
        public static T RemoveAndGet<T>(this IList<T> list, int index)
   {
      var value = list[index];
      list.RemoveAt(index);
      return value;
   }
}

Related Tutorials