Is there a way to transfrom a list of key/value pairs into a data transfer object
- by weevie
...apart from the obvious looping through the list and a dirty great case statement!
I've turned over a few Linq queries in my head but nothing seems to get anywhere close.
Here's the an example DTO if it helps:
    class ClientCompany
    {
      public string Title { get; private set; }
      public string Forenames { get; private set; }
      public string Surname { get; private set; }
      public string EmailAddress { get; private set; }
      public string TelephoneNumber { get; private set; }
      public string AlternativeTelephoneNumber { get; private set; }
      public string Address1 { get; private set; }
      public string Address2 { get; private set; }
      public string TownOrDistrict { get; private set; }
      public string CountyOrState { get; private set; }
      public string PostCode { get; private set; }
    }
We have no control over the fact that we're getting the data in as KV pairs, I'm afraid.