KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Consider the following Generic class: public class Custom<T> where T : string { } This produces the following error: 'string' is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter. Is there another way to constrain which types my generic class can use? Also, can I constrain to multiple types? E.G. T can only be string, int or byte
Tags (comma-separated)
Save Edits
Cancel