It seems like you would be able to write an extension method to accomplish this: (Syntax may be a little off - I don't currently have access to a resource)
public void IList<T> WriteListToConsole(this IEnumerable<T> source)
{
var list = source as IList<T>;
foreach(string item in list)
{
Console.WriteLine(item);
}
}
Rion William...
All-Star
32044 Points
5207 Posts
Re: Trying to string.Join an IList and outputting the results to console.
Apr 12, 2012 03:24 PM|LINK
It seems like you would be able to write an extension method to accomplish this: (Syntax may be a little off - I don't currently have access to a resource)
public void IList<T> WriteListToConsole(this IEnumerable<T> source) { var list = source as IList<T>; foreach(string item in list) { Console.WriteLine(item); } }