Dot Net Interview Questions and Tutorials
By Dr. Rajesh Rolen
Monday, January 30, 2012
Best Extension Methods: AddRange To Collection
Using below extension method we can add a multiple values to a typed collection in one go.
//add value to collection in one statement
public static void AddRange(this ICollection list, params S[] values)
where S : T
{
foreach (S value in values)
list.Add(value);
}
No comments:
Post a Comment