[英]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.