Why type alias can't reference to another type alias? #3264
-
using IntList = System.Collections.Generic.List<int>; // ok
using IntListFactory = System.Func<IntList>; // Cannot resolve symbol 'IntList' |
Beta Was this translation helpful? Give feedback.
Answered by
CyrusNajmabadi
Mar 11, 2020
Replies: 2 comments
-
Because usings aren't in 'scope' for subsequent using statements. This was an explicit decision at the time to keep the lookup rules much simpler for the language. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
YairHalberstadt
-
Only for subsequent using statements in the same scope, though. This works fine: using IntList = System.Collections.Generic.List<int>;
namespace Foo
{
using IntListFactory = System.Func<IntList>;
// ...
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because usings aren't in 'scope' for subsequent using statements. This was an explicit decision at the time to keep the lookup rules much simpler for the language.