When doing this in C#:
using Word = System.String;
using Words = System.Collections.Generic.List<Word>;
The compiler complains that "the type or namespace 'Word' could not be found". Is this not possible? If it makes a difference, I'm trying to do this in the global namespace.
EDIT: just found another SO that answers this: Why can one aliased C# Type not be accessed by another? This can marked as duplicate.
No. These aliases only apply within the namespace body.
Source
You can work around this limitation by moving the 2nd using
inside the namespace body like this:
using Word = System.String;
namespace MyNamespace {
using Words = System.Collections.Generic.List<Word>;
...
}
The best you can do is:
using Word = System.String;
using Words = System.Collections.Generic.List<System.String>;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With