This example gives a “The type or namespace name ‘MyType’ could not be found (are you missing a using directive or an assembly reference?)”
using MyType = System.Func<System.Int32, System.Tuple<System.Int32, MyType>>;
Is it at all possible to declare a recursive type like this?
No, I don’t think it is possible. The right-hand side of your
usingstatement needs to resolve to a real type before you can assign an alias to it. In your case, in order to resolve the right-hande side, the compiler must fully define the allias… which requires it to resolve the right-hand side. This recursive problem has no ending, so the compiler is clearly not going to bother.To make the problem here more clear: lets assume the compiler managed to compile your alias, and I did this:
What could I possible put in the body of the function to define the return value? Eventually I need to have a constructable type somewhere to return.