Reputation: 89
My Method define is
public ActionResult _Create3<T>() where T:IMyClass, new()
but I want define tow generic type
public ActionResult _Create3<T, G>(G content) where T:IMyClass, new()
Type G must also use interface ImyClass but I Dont know define in where tow type !!!
for example if may be write :
public ActionResult _Create3<T, G>(G content) where {T:IMyClass, G:IMyClass}, new()
but get error.
thanks for answer
Upvotes: 2
Views: 534
Reputation: 25742
You can define multiple where
constraints on multiple generic types like:
public ActionResult _Create3<T, G>(G content) where T:IMyClass, new()
where G:IMyClass, new()
Upvotes: 4
Reputation: 45058
Add another where
constraint for that generic type:
public ActionResult _Create3<T, G>(G content)
where T : IMyClass, new()
where G : IMyClass, new()
Upvotes: 7