I have a problem with the method where and the generic list.
public class TestList : List<Test2>
{
public TestList getWork()
{
return (TestList)this.Where(a => a.ID=10);
}
}
I have the error follow:Unable to cast object of type 'WhereListIterator`1[Test2]' to type 'TestList'.
Example 2 , why is not a good idea use code like this:
public class Parent : List<Child>
{
public Parent GetChildOf(Child child)
{
...
return childofchild;
}
public Parent GetParentOf(Child child)
{
...
}
}
in code in control .net I use my class like this:
parents.GetParentOf(childselected).GetParentOf(otherchild);....
Thanks for your help.