What you're trying to do is equivalent to this:
Animal animal = new Animal();
Dog dog = animal as Dog;
One possible solution is to provide a constructor that takes an existing list, and calls the base constructor, such as:
public class ColumnList : List<Column>
{
public ColumnList(IEnumerable<Column> collection):
base(collection)
{
}
}
And then build your ColumnList
from an existing collection.
var collection = othercolumnlist.Select(c => new Column { Name = c.Name });
var columnList = new ColumnList(collection);
You could also provide an extension method to make this easier:
public static class ColumnListExtensions
{
public static ToColumnList(this IEnumerable<Column> collection)
{
return new ColumnList(collection);
}
}
var cols = othercolumnlist.Select(c => new Column { Name = c.Name })
.ToColumnList();