title: String split to object with Linq?
body: <p>Given:</p>
  
  <pre><code>    class T
      {
          public string A { get; set; }
          public string B { get; set; }
      }
  
      string s = "A|B";
  </code></pre>
  
  <p>Is there a way to split s on the | and return a T object "inline"? I know I can do something like:</p>
  
  <pre><code>s.Select(x =&gt; { string[] arr = s.Split(); return new T() { A = arr[0], B = arr[1] };
  </code></pre>
  
  <p>But I'm wondering if there is some obscure linq thing to do it "inline" without declaring the array and splitting inside of the select. Something more along the lines of:</p>
  
  <pre><code>s.Split().Select(x =&gt; new T() { A = x[0], B = x[1] });
  </code></pre>
  
  <p>Obviously that'll give you a compiler error, but you get the idea... is there a way to do it like that?</p>