-2

I've seen this once or twice and don't have the foggiest idea what it's for:

using Point = This.Namespace.Thing.Point

In a couple of examples online I've seen this sort of syntax along with the rest of the usual using directives one is used to seeing. What's this all about?

wootscootinboogie
  • 8,461
  • 33
  • 112
  • 197

1 Answers1

3

it is a shorthand notation or alias for Namespace.

you can use it to avoid typing lengthy namespaces.

using Point = This.Namespace.Thing.Point;

if you write as above then

This.Namespace.Thing.Point.anyClassName 

is Equals to

Point.anyClassName
Sudhakar Tillapudi
  • 25,935
  • 5
  • 37
  • 67
  • So what's the purpose of including an alias for a namespace? I guess if you have to different namespaces with the class Point? – wootscootinboogie Feb 19 '14 at 15:22
  • @wootscootinboogie: you are absolutly right , either you can use it to avoid typing lengthy namespace or to avoid ambiguity between two different namespaces – Sudhakar Tillapudi Feb 19 '14 at 15:26
  • 1
    @wootscootinboogie, in my experience, the use of the `using` directive as an alias is for one of three things - either to change the spelling of a type in a namespace you do not control, to use a shorter version of a long class name, or to give a more meaningful name to a generic type (e.g., `NamePair` instead of `Tuple`). – Matt Davis Feb 19 '14 at 15:28