James Troutman
James Troutman

Reputation: 211

Scaffold/Generate an object's properties in an initializer

Does anyone know how to "scaffold" or "generate" a constructor block for all of an objects properties? I've got VS2010 with Resharper and am looking to generate something like:

    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
                                    };

Where I can then double back and fill in the blanks so to speak. Everything i've found is all DatabaseFirst and Getter/Setters Class Properties...

Upvotes: 5

Views: 961

Answers (1)

brgerner
brgerner

Reputation: 4371

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.

Upvotes: 1

Related Questions