Take a look at at the code below.
void Foo1<T>() where T : struct, IBar1, IBar2, IBar3 {}
void Foo2<T>() where T : struct, IBar1, IBar2, IBar3 {}
void Foo3<T>() where T : struct, IBar1, IBar2, IBar3 {}
How can I alias the constraints on the right side of each declaration so that those declarations can become shorter and more readable?
Conceptually, what I'm after should look similar to this (not valid C# code):
MyConstraint<T> = T : struct, IBar1, IBar2, IBar3;
void Foo1<T>() where T : MyConstraint {}
void Foo2<T>() where T : MyConstraint {}
void Foo3<T>() where T : MyConstraint {}
That T : struct
is the most crucial part for my use case.
If there is no such grammar in C#, what alternatives do you suggest to reduce the clutter here?