title: Get property from JSON by string name (already deserialized to class)
body: <p>I'm using <a href="https://currencylayer.com/documentation" rel="nofollow noreferrer">https://currencylayer.com/documentation</a> , Free account's currency conversion API. I let user input output currency, so for example if user input SGD, It'll display the currency conversion for USD to SGD:"USDSGD":1.318504 
  The way to grab that value is to use dynamic deserializer, and put it to a label. like so:</p>
  
  <pre><code>   lblResult.Text=test.quotes.USDSGD.ToString();
  </code></pre>
  
  <p>But what I want is to get the result regardless of the user selected currency. The other is always USD so I’d like to combine that and the user input currency to get the correct value from the API, like:</p>
  
  <pre><code>var propertyName = "USD" + destinationCurrencyName; // "USDSGD"
  lblResult.Text=test.quotes.{propertyName}; // what I'd like
  </code></pre>
  
  <p>Here I would access the property "USDSGD". </p>
  
  <p>I know that I can use reflection (<a href="https://stackoverflow.com/questions/1196991/get-property-value-from-string-using-reflection-in-c-sharp">Get property value from string using reflection in C#</a>) but that seem to be overkill. </p>
  
  <p>This is what the query returns:</p>
  
  <pre><code>{
    "success":true,
    "terms":"https:\/\/currencylayer.com\/terms",
    "privacy":"https:\/\/currencylayer.com\/privacy",
    "timestamp":1517629571,
    "source":"USD",
    "quotes":{
      "USDSGD":1.318504
    }
  }
  </code></pre>
  
  <p>This is my code - strongly typed version indeed produces expected result, but I'd like to read name of currency (essentially property name of <code>quotes</code> element) from text box:</p>
  
  <pre><code>protected void btnConvert_Click(object sender, EventArgs e)
  {
      string convertTo = TextBox1.Text.ToString();
      var webRequest = (HttpWebRequest)WebRequest.Create("http://apilayer.net/api/live?access_key=MY_ACCESS_KEY&amp;currencies=" + Server.UrlEncode(convertTo) + "&amp;source=USD&amp;format=1");
      var webResponse = (HttpWebResponse)webRequest.GetResponse();
      if (webResponse.StatusCode == HttpStatusCode.OK)
      {
          JavaScriptSerializer json = new JavaScriptSerializer();
          StreamReader sr = new StreamReader(webResponse.GetResponseStream());
          var resString = sr.ReadToEnd();
          //var test = JsonConvert.DeserializeObject&lt;Result&gt;(resString);
          //lblResult.Text=test.quotes.USDSGD.ToString();
          var test2 = JsonConvert.DeserializeObject&lt;dynamic&gt;(resString);
          lblResult.Text = test2.quotes.USD+convertTo;
      }
  }
  </code></pre>
  
  <p>Currently my code </p>
  
  <pre><code>var test2 = JsonConvert.DeserializeObject&lt;dynamic&gt;(resString);
          lblResult.Text = test2.quotes.USD+convertTo;
  </code></pre>
  
  <p>Returns the value:</p>
  
  <blockquote>
    <p>SGD</p>
  </blockquote>
  
  <p>Since the "convertTo" Variable happens to be "SGD".</p>
  
  <p>I want the code to execute <code>lblResult.Text = test2.quotes.USD+convertTo;</code> not return me "convertTo" variable.</p>