0

I write enum with custom ToString() method example

 public enum MyEnum{ a, b, } My = MyEnum.a; Console.Write(My.ToString); // ---> output : aaaaa 

and in code My.ToString() Do you have idea ?

1

1 Answer 1

1

Another simple technich if you dont need complex string, is to have 2 enum collection

public enum MyEnum1{ a, b, } public enum MyEnum2{ aaaaa, bbbbb, } var My = MyEnum.a; Console.Write((MyEnum2)My).ToString()) // ---> output : aaaaa 
Sign up to request clarification or add additional context in comments.

2 Comments

Your answer was interesting
the comment of Marteen is good too but more complex with attributes..another way if you have complex string is to create dictionary<enum, string>

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.