当我使用CleanCode时,Resharper正在包装我的代码?

时间:2015-12-02 20:29:57

标签: c# resharper

我想问一下如何在ReSharper清洁代码中设置覆盖C#样式,因为我想在一行中进行列表声明而不是每个属性多行 我想要的是什么

var listOfValues = new List<Value>
{
    new Value{ UniqeId = Guid.NewGuid(),ControlId = 1,Name=""},
    new Value{ UniqeId = Guid.NewGuid(),ControlId = 1,Name=""},
    new Value{ UniqeId = Guid.NewGuid(),ControlId = 1,Name=""},
}

我不想要这种风格

var listOfValues = new List<Value>
{
    new Value
    {
        UniqeId = Guid.NewGuid(),
        ControlId = 1,
        Name = "",
        Description = "",
        ModifiedBy = "",
        ModifiedOn = DateTime.Now,
        CreatedBy = "",
        CreatedOn = DateTime.Now
    },
    {
        UniqeId = Guid.NewGuid(),
        ControlId = 1,
        Name = "",
        Description = "",
        ModifiedBy = "",
        ModifiedOn = DateTime.Now,
        CreatedBy = "",
        CreatedOn = DateTime.Now
    },
    {
        UniqeId = Guid.NewGuid(),
        ControlId = 1,
        Name = "",
        Description = "",
        ModifiedBy = "",
        ModifiedOn = DateTime.Now,
        CreatedBy = "",
        CreatedOn = DateTime.Now
    }
};

1 个答案:

答案 0 :(得分:2)

包裹数组初始化程序更改为简单包装

Wrap array initializer

希望它有所帮助。