tags:

views:

1739

answers:

3

What is the syntax for placing constraints on multiple types? The basic example:

class Animal<SpeciesType> where SpeciesType : Species

I would like to place constraints on both types in the following definition such that SpeciesType must inherit from Species and OrderType must inherit from Order:

class Animal<SpeciesType, OrderType>
+10  A: 
public class Animal<SpeciesType,OrderType>
    where SpeciesType : Speciese
    where OrderType : Order
{
}
Darren Kopp
+5  A: 

You should be able to go :

Class Animal<SpeciesType, OrderType>
    where SpeciesType : Species
    where OrderType : Order
Ryan Lanciaux
A: 

Dang, beat me to it while I was double checking :)

Ryan Lanciaux
Hehe, I gave you an upvote for spelling Species correctly :P
Luke
haha, thanks :)
Ryan Lanciaux