title: Is there a method to swap the left and right hand sides of a set of expressions in Visual Studio?
body: <p>I have a decent sized set of data that needs to be stored in an active record. In order to prepopulate the form fields on the page, I have already written the following code:</p>
  
  <pre><code>Device device = new Device(DeviceID); // device is simply the active record
  
  txtDeviceName.Text = device.Name;
  txtNotes.Text = device.Notes;
  txtHostName.Text = device.Hostname;
  txtAssetTag.Text = device.AssetTag;
  txtSerialNumber.Text = device.SerialNumber;
  // snip... the list goes on!
  </code></pre>
  
  <p>Is there some sort of the method (built-in functionality, macro, etc.) that I could use to swap each side of the expression such that the data is saved into the active record as opposed to read from it in order to perform a database insert? For example, after highlighting the above code and running the macro, it would become:</p>
  
  <pre><code>device.DeviceName = txtDeviceName.Text;
  device.Notes = txtNotes.Text;
  device.Hostname = txtHostName.Text;
  device.AssetTag = txtAssetTag.Text;
  device.SerialNumber = txtSerialNumber.Text;
  // snip again...
  </code></pre>
  
  <p>Since the number of columns in the database that this active record encapsulates is rather large, it seems like most of this typing could be avoided with a simple automated process.</p>
  
  <p>Obviously this wouldn't work 100% because sometimes there would have to be type conversions (e.g. <code>int</code> to <code>string</code>) but for the most part I think this would save a lot of time.</p>