2

Consider the following struct:

public class Definitions
{
    public struct A
    {
        public struct B
        {
            public struct C
            {
                public struct D
                {
                    public struct E
                    {
                        public static string foo = "";
                        public static string bar = "";
                    }
                }
            }
        }
    }
}

To refer to foo, I must use:

Definitions.A.B.C.D.E.foo

Is it possible to declare a variable like such?

   struct E = Definitions.A.B.C.D.E;

So then I can refer to it in code via:

E.foo
E.bar

How can I achieve this? Thanks

Joey
  • 344,408
  • 85
  • 689
  • 683
David
  • 15,652
  • 26
  • 115
  • 156

1 Answers1

6

You can use the using directive to assign an alias:

using E = Definitions.A.B.C.D.E;
Joey
  • 344,408
  • 85
  • 689
  • 683