Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@MrJul
Last active January 24, 2018 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MrJul/7da12f5f2d6c69f03d79 to your computer and use it in GitHub Desktop.
Save MrJul/7da12f5f2d6c69f03d79 to your computer and use it in GitHub Desktop.
// definitions
public abstract class ClassConstraint<TClass>
where TClass : class
{
public class GenericClassWhereIWantTEnumRestricted<TEnum>
where TEnum : struct, TClass
{
}
}
public class EnumConstraint : ClassConstraint<Enum> {
}
// usage
var x = new EnumConstraint.GenericClassWhereIWantTEnumRestricted<MyEnum>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment