I have a real banged up API where the return values using naming conventions that are all over the place… From to camel case to Pascal case to upper case to string with spaces… it’s a mess…
So in order to serialize or deserialize it, using json.net is simple enough adding a jsonSerializer or adding a class with json property attributes as so:
[JsonProperty(PropertyName = "somebanged upName")]
public string[] SomethingBangedUp;
I would also like to do a similar thing when hardtyping some values to an enum, and then get a list of the ‘banged up names’ rather than the variable names:
public enum SomeBangedUpEnum
{
[EnumMember(Value = "someThingelse BangedUp")]
SomethingElseBangedUp,
}
var v = Enum.GetNames(typeof(SomeBangedUpEnum)).ToList();
But this retrives the variable name of “SomethingElseBangedUp” and not “someThingelse BangedUp” as i hoped for;
Any idea how I can get the banged up value set by the EnumMember attribute?