c# - Visual Studio replacing Object Initializer with constructor -


i have replace ~250 instances of object initializers constructor same parameters.

this example of object initializer:

throw new faultexception<dtfaultdetail>(new dtfaultdetail {     isuserwarning = true,     httpstatuscode = (int)httpstatuscode.forbidden,     category = (int)faultcategory.user,     errorcode = (int)faultcode.jobs_timesheetoverlapsexisting,     usermessage = userstrings.timesheetoverlapsexisting,     debugmessage = $"",     ticksusedbeforefailure = dbcontext.requestinfo.totalticksused,     origin = new dtfaultdetail.faultorigin     {         session = session,         threadid = thread.currentthread.managedthreadid,         source = $"{fullnameofthisclass}.{methodbase.getcurrentmethod()})"     } }); 

and had replace this:

throw new faultexception<dtfaultdetail>(new dtfaultdetail(     isuserwarning: true,     httpstatuscode: (int)httpstatuscode.forbidden,     category: (int)faultcategory.user,     errorcode: (int)faultcode.jobs_timesheetoverlapsexisting,     usermessage: userstrings.timesheetoverlapsexisting,     debugmessage: $"",     ticksusedbeforefailure: dbcontext.requestinfo.totalticksused,     origin: new dtfaultdetail.faultorigin     {         session = session,         threadid = thread.currentthread.managedthreadid,         source = $"{fullnameofthisclass}.{methodbase.getcurrentmethod()})"     })); 

how can quickly, using built-in features of visual studio (2015)?

besides manual replacement, of course.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -