using System.Collections.Generic;
public static class ListUtil
{
public static string Display<T>(this IList<T> self)
{
if (self == null || self.Count <= 0)
return "";
var builder = new System.Text.StringBuilder();
builder.AppendLine("[Display IList]");
for (var i = 0; i < self.Count; i++)
builder.AppendLine(string.Format("[{0}] : {1}", i, self[i]));
return builder.ToString();
}
}
using System.Collections.Generic;
private void Sample()
{
var list = new List<int>()
{
1, 2, 3, 4, 5
};
list.Display();
}