What i do have:
I am declaring a large number of fields most of which are given its own name as string value. Something like
string ErrorCode0001 = "ErrorCode0001-C";
string ErrorCode0002 = "ErrorCode0002";
string ErrorCode0003 = "ErrorCode0003";
string ErrorCode0004 = "ErrorCode0004";
string ErrorCode0005 = "ErrorCode0005";
string ErrorCode0006 = "ErrorCode0001";
Now, if you put attention in the code above i had a mistake in ErrorCode0006, which is hard to notice.
The mistake above comes because i copy pasted the first Field declaration and and then just modified the suffix number, missing the one in the last field.
What i would like to have:
I would love to write something like
string ErrorCode0001 = $"{nameof(self)}-C";
string ErrorCode0002 = $"{nameof(self)}";
string ErrorCode0003 = $"{nameof(self)}";
string ErrorCode0004 = $"{nameof(self)}";
string ErrorCode0005 = $"{nameof(self)}";
string ErrorCode0006 = $"{nameof(self)}";
but i am not sure how to do this in C#.
Would love to see some clever suggestions here.