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
Post a Comment