支架/在初始化程序中生成对象的属性

时间:2012-07-02 20:48:45

标签: visual-studio-2010 resharper

有没有人知道如何为所有对象属性“搭建”或“生成”构造函数块?我有VS2010和Resharper,我希望生成类似的东西:

    public Customer CustomerB = new Customer
                                    {
                                        firstName = "",
                                        middleName = "",
                                        lastName = "",
                                        additionalPhone = "0",
                                        address1 = "",
                                        address2 = "",
                                        birthDate = new DateTime(),
                                        cellPhone = "",
                                        city = "",
                                        driverLicenseNumber = "",
                                        driverLicenseState = "",
                                        emailAddress = "",
                                        country = "",
                                        fax = "",
                                        grossIncome = 0,
                                        education = null,
                                        leadRequest = null
                                    };

然后我可以加倍回填并填补空白。我发现的一切都是DatabaseFirst和Getter / Setters类属性......

1 个答案:

答案 0 :(得分:1)

我认为不可能使用VS和ReSharper为所有属性生成对象初始值设定项。您需要为每个属性选择按 Ctrl + Space