Mic*_*los 6 c# json visual-studio
在 Visual Studio 中编辑字符串时,有一个名为 的选项Enable All JSON editor features,它可以向数据添加注释。

评论看起来像这样:
/*lang=json,strict*/
Run Code Online (Sandbox Code Playgroud)
仅当 C# 代码中的字符串包含序列化 JSON 时才会弹出。我无法在网上找到任何相关文档。是不是有什么隐藏功能?字符串中是否以类似的方式支持其他语言(SQL/YAML/JavaScript)?
我只知道lang=regex也支持。
但是,在 .NET7 中:
\n请参见:
\n\\"逃避,\n\n\n
StringSyntaxAttribute它允许您用参数的含义来标记参数,然后这将成为编辑器的线索。例如:\nvar s = "...";\n...\nvoid F([StringSyntax(StringSyntaxAttribute.DateTimeFormat)]string s)\nRun Code Online (Sandbox Code Playgroud)\n 支持它的编辑器(例如 Visual Studio 2022)将:\ns(使用yyyy、MM等提示),StringSyntaxAttribute.Json目前这最有效)。 \n | 归档时间: |
|
| 查看次数: |
423 次 |
| 最近记录: |