KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is there a way to generate a class constraint with CodeDom. Because when I use something like var method = new CodeMemberMethod(); var genericParam = new CodeTypeParameter("InterfaceType"); genericParam.Constraints.Add("class"); method.TypeParameters.Add(genericParam); the generated code is like private InterfaceType GetImpl<InterfaceType>() where InterfaceType : @class { } The best workaround i found is to use a leading whitespace before the class genericParam.Constraints.Add(" class"); But this seems to be at best a workaround.
Tags (comma-separated)
Save Edits
Cancel