什么[JsonProperty]用于c#?

时间:2018-01-29 15:36:53

标签: c# .net json

例如,为什么在下面的代码中需要它,如何进一步使用?

public class FileAttachment
{
    [JsonProperty("fileName")]
    public string FileName{ get; set; }
}

1 个答案:

答案 0 :(得分:1)

Per the documentation:这是在将此对象序列化/反序列化为json字符串时使用的json键。

因此,如果for /r %%f in (*.pdf) do ( ren "%%~nf%%~xf" "%%~nf Scanned%%~xf" ) 的值为FileName,则序列化结果为

file.txt
相关问题