我喜欢这样的语法:
Something something = new Something
{
Property1 = "property1",
Property2 = "property2"
}
但在当前项目中,我看到以下内容:
Something something = new Something();
something["Property1"] = "property1";
something["Property2"] = "property2";
我想知道是否有办法重构后者以某种方式接受后者的语法。我试图看看智能感知会提出什么建议,但没有变得更聪明。建议?