Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 423
James Troutman Avatar asked Nov 14 '22 02:11

James Troutman


1 Answers

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.

like image 122
brgerner Avatar answered Dec 22 '22 08:12

brgerner