title: Xamarin Android: getting color value from colors.xml programmatically
body: <p>How can I get value of color programmatically from colors.xml file into C# code?</p>
  
  <p>Here is my colors.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;resources&gt;
  
    &lt;item name="row_a" type="color"&gt;#FFCCFFCC&lt;/item&gt;
    &lt;item name="row_b" type="color"&gt;#FFFFFFCC&lt;/item&gt;
    &lt;item name="all_text" type="color"&gt;#FF000000&lt;/item&gt;
    &lt;item name="row_red" type="color"&gt;#FFFF4444&lt;/item&gt;
    &lt;item name="row_orange" type="color"&gt;#FFE69900&lt;/item&gt;
    &lt;item name="row_green" type="color"&gt;#FF739900&lt;/item&gt;
    &lt;item name="wheat" type="color"&gt;#FFF5DEB3&lt;/item&gt;
  
    &lt;integer-array name="androidcolors"&gt;
      &lt;item&gt;@color/row_a&lt;/item&gt;
      &lt;item&gt;@color/row_b&lt;/item&gt;
      &lt;item&gt;@color/all_text&lt;/item&gt;
      &lt;item&gt;@color/row_red&lt;/item&gt;
      &lt;item&gt;@color/row_orange&lt;/item&gt;
      &lt;item&gt;@color/row_green&lt;/item&gt;
      &lt;item&gt;@color/wheat&lt;/item&gt;
    &lt;/integer-array&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>Color t = (Color)Resource.Colors.wheat;
  </code></pre>
  
  <p>but of course I cannot convert int value to Color this way. </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>As suggested I tried</p>
  
  <pre><code>Color t = Resources.GetColor(Resource.Color.row_a);
  </code></pre>
  
  <p>But it gives me an error:</p>
  
  <pre><code>Error   CS0120  An object reference is required for the non-static field, 
  method, or property 'Resources.GetColor(int)'
  </code></pre>