I'm sure I've done this before, but can't find any example of it! Grrr...
For example, I want to convert an IList<T>
into a BindingList<T>
:
public class ListHelper
{
public static BindingList<T> ToBindingList(IList<T> data)
{
BindingList<T> output = new BindingList<T>();
foreach (T item in data)
output.Add(item);
return output;
}
}
You can do this by extension method and it would be better.
Wouldn't this be simpler?
It's so simple that we don't need an extension method ...
Am I missing something?