Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Alternatively if you don't want to go with reflection you could use this (this wont' work blazingly fast):</p> <pre><code>var ccd = new List&lt;KeyValuePair&lt;string, string&gt;&gt;(); ccd.Add(new KeyValuePair&lt;string, string&gt;("Title", "")); ccd.Add(new KeyValuePair&lt;string, string&gt;("Forenames", "")); ccd.Add(new KeyValuePair&lt;string, string&gt;("Surname", "")); ccd.Add(new KeyValuePair&lt;string, string&gt;("EmailAddress", "")); ccd.Add(new KeyValuePair&lt;string, string&gt;("TelephoneNumber", "")); ccd.Add(new KeyValuePair&lt;string, string&gt;("AlternativeTelephoneNumber", "")); ccd.Add(new KeyValuePair&lt;string, string&gt;("Address1", "")); ccd.Add(new KeyValuePair&lt;string, string&gt;("Address2", "")); ccd.Add(new KeyValuePair&lt;string, string&gt;("TownOrDistrict", "")); ccd.Add(new KeyValuePair&lt;string, string&gt;("CountyOrState", "")); ccd.Add(new KeyValuePair&lt;string, string&gt;("PostCode", "")); var data = new List&lt;List&lt;KeyValuePair&lt;string, string&gt;&gt;&gt; { ccd, ccd, ccd }; var companies = from d in data select new ClientCompany { Title = d.FirstOrDefault(k =&gt; k.Key == "Title").Value, Forenames = d.FirstOrDefault(k =&gt; k.Key == "Forenames").Value, Surname = d.FirstOrDefault(k =&gt; k.Key == "Surname").Value, EmailAddress = d.FirstOrDefault(k =&gt; k.Key == "EmailAddress").Value, TelephoneNumber = d.FirstOrDefault(k =&gt; k.Key == "TelephoneNumber").Value, AlternativeTelephoneNumber = d.FirstOrDefault(k =&gt; k.Key == "AlternativeTelephoneNumber").Value, Address1 = d.FirstOrDefault(k =&gt; k.Key == "Address1").Value, Address2 = d.FirstOrDefault(k =&gt; k.Key == "Address2").Value, TownOrDistrict = d.FirstOrDefault(k =&gt; k.Key == "TownOrDistrict").Value, CountyOrState = d.FirstOrDefault(k =&gt; k.Key == "CountyOrState").Value, PostCode = d.FirstOrDefault(k =&gt; k.Key == "PostCode").Value, }; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload