In this case, you're not redefining the type parameter on the method, so you can't apply any new constraints. You should be able to do it this way: public static IEnumerable GetManyByParentId( ref List items, Guid parentId) where T2 : T, HasIdAndParentId { .. }.
Thank you very much Ben – Scott Rickman Aug 13 '10 at 15:55.
Make the GetManyByParentId method itself generic, and tie it's generic parameter to T: public static IEnumerable GetManyByParentId( ref List items, Guid parentId) where R : T, HasIdAndParentId.
Ben M: You are correct, I completely misread the question ... I've updated my answer. It seems I need to take a break and get some coffee :) – LBushkin Aug 13 '10 at 15:23.
Ben M's code sample will not compile unless HasIdAndParentId is an interface type, which it is not, judjing by the name. Making the second method itself generic and making it depending on its own type parameter (distinct from T) will provide you the desired constraint. Public static IEnumerable GetManyByParentId(ref List items, Guid parentId) where T1 : HasIdAndParentId { // the parentId is a property of HasIdAndParentId which subclasses HasId return from I in items where i.
ParentId == parentId select i; }.
HasIdAndParentId sounds like an (unconventionally-named) interface to me; remember has-a vs. is-a – Ben M Aug 13 '10 at 16:31 HasId is NOT an interface and doesn't need to be one; Where T: HasId is base type constraint – Scott Rickman Aug 16 '10 at 10:11.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.