【发布时间】:2017-09-28 18:04:14
【问题描述】:
一些字典,"key1" = "Value1, "key2" = "Value2", ...。
我需要创建一个对象
{
key1 : "Value1",
key2 : "Value2",
...
}
【问题讨论】:
-
SmartFormat.Net 库要求您以上述@grant 的形式传递对象
-
您可能不需要这样做。 SmartFormat.NET 处理字典。
var dict = new Dictionary<String,Object>() { {"Name", "Smart"},{ "Address", new { City = "GitHub", State = "WWW" } } }; Debug.Assert("Smart from GitHub, WWW" == Smart.Format("{Name} from {Address.City}, {Address.State}", dict)); -
您应该修改原始问题stackoverflow.com/questions/33027613/…....,而不是添加更多问题
标签: c# .net object dictionary