小编Tri*_*Jak的帖子

Json.Net 中的 [JsonRequired] 和 [JsonProperty(Required = required.Always)] 属性之间有什么区别(如果有)?

正如标题中提到的,尽管我查看了以下属性的文档,但我不明白不同的用例是什么。

[JsonRequired]
public string someProperty;

[JsonProperty(Required = Required.Always)]
public string someOtherProperty;
Run Code Online (Sandbox Code Playgroud)

是否存在某种情况下我们应该使用其中一种而不是另一种?

研究的链接:JsonRequiredAttributeJsonPropertyAttribute classJsonPropertyAttribute required

c# json.net asp.net-core

6
推荐指数
0
解决办法
1191
查看次数

标签 统计

asp.net-core ×1

c# ×1

json.net ×1