Add one element to IEnumerable - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:IEnumerable

Description

Add one element to IEnumerable

Demo Code


using System.Linq;
using System.Collections.Generic;
using System;//w w w. ja  va2  s .c  o  m

public class Main{
        public static IEnumerable<T> Concat<T>(this IEnumerable<T> head, T tail)
    {
      return head.Concat(Enumerable.Repeat(tail, 1));
    }
}

Related Tutorials