【问题标题】:Is there: C# literals library是否有:C# 文字库
【发布时间】:2023-03-25 22:29:01
【问题描述】:

是否有针对不同数据结构和内置类的ToString C# 库?

与扩展方法库相同吗?我想许多开发人员使用它们进行调试,查看数据包含的内容。

例如:Debug.Writeline(dict); 可能会给我以下信息:

new Dictionary<string,string>() {{ "abc", "def" } , {"lmn", "opq"}};

或不同的风格。

谢谢。

【问题讨论】:

  • 大多数人只使用调试器。

标签: c# debugging extension-methods literals render-to-string


【解决方案1】:

您可能想试试这个库:http://www.servicestack.net/mythz_blog/?p=202。无论如何,以前有人提出过类似的问题:How to use the LinqPad .Dump() extension method in Visual Studio?

【讨论】:

  • 该问题中提到的 json 序列化程序完全符合我的需求。