is it possible to define using
inline (instead of putting this command in the top of the c#
file) , like:
private void smth()
{
using XYZ = OtherNameSpace.ClassName;
XYZ.Hello(); ...
}
or what can I do to make "aliased" class/namespaces inline?
答案 0 :(得分:3)
The answer is in the official docs:
The
using
directive can appear:
- At the beginning of a source code file, before any namespace or type definitions.
- In any namespace, but before any namespace or types declared in this namespace.