5

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

    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 类属性......

4

1 回答 1

1

I think it is not possible to generate object initializer for all properties with VS and ReSharper. You need to press Ctrl+Space for every property selection.

于 2012-07-03T09:10:23.110 回答