[英]C# JSON convert enums to/from strings
关于将枚举与字符串进行通用转换存在一个问题。 这个问题有点不同。
ASP.NET Web API 2应用程序中是否可以为调用定义控制器API,该调用将接收/返回JSON,而该属性是JSON中的字符串,但被声明为枚举?
如果您使用的是JSON.NET,则可以将以下属性用于Enum对象-
[JsonConverter(typeof(StringEnumConverter))]
检查此链接 。
[英]Associating enums with strings in C#
[英]Associating Strings with enums in C#
[英]Convert multiple json strings to dataset in c#
[英]Convert a list of hierachical strings to JSON in C#
[英]how to convert java enums in c#
[英]Convert byte array to collection of enums in C#
[英]C#: How to parse JSON enums
[英]How to convert json strings into anonymous types in c#?
[英]enums error in vb, how is it different from enums in c#?
[英]C# - Web API - Serializing Enums as strings with spaces
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.