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

1

1 Answer 1

6

You can use the using directive to assign an alias:

using E = Definitions.A.B.C.D.E;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.