Would like to both filter and convert a List. I can filter but cannot figure out how to convert. PROBLEM, the return statement returns a List of FieldDef. How do I get a List of the FieldDefsEnum1 from fieldsDefs? Thanks in advance.
FieldDefEnum1 : FieldDef
List<FileDef> fieldDefs
public List<FieldDefEnum1> FieldDefsEnum1
{
get
{
return FieldDefs.Where(fd => fd.GetType() == typeof(FieldDefEnum1)).ToList();
}
}
You can use
OfType<T>()instead: