title: Destructuring assignment - object properties to variables in C#
body: <p>JavaScript has a nifty feature where you can assign several variables from properties in an object using one concise line. It's called <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment" rel="noreferrer">destructuring assignment</a> syntax which was added in ES6.</p>
  
  <pre><code>// New object
  var o = {p1:'foo', p2:'bar', p3: 'baz'};
  // Destructure
  var {p1, p2} = o;
  // Use the variables...
  console.log(p1.toUpperCase()); // FOO
  console.log(p2.toUpperCase()); // BAR
  </code></pre>
  
  <p>I want to do something similar with C#.</p>
  
  <pre><code>// New anonymous object
  var o = new {p1="foo", p2="bar", p3="baz"};
  // Destructure (wrong syntax as of C#6)
  var {p1, p2} = o;
  // Use the variables...
  Console.WriteLine(p1.ToUpper()); // FOO
  Console.WriteLine(p2.ToUpper()); // BAR
  </code></pre>
  
  <p>Is there a syntax to do this in C#?</p>