title: Portable Class Library Reflection GetField
body: <p>I am currently trying to convert a Xamarin.iOS app library to a PCL. I have this code that will not compile:</p>
  
  <pre><code>    private void SetPrivateField&lt;T&gt;(object item, string fieldName, object value) {
          typeof(T).GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic)
              .SetValue(item, value);
      }
  </code></pre>
  
  <p>As you can see I am trying to set a private field for a type. Is there another way?</p>
  
  <p><strong>EDIT</strong>
  This compiles. Will it do the same thing?</p>
  
  <pre><code> private void SetPrivateField&lt;T&gt;(object item, string fieldName, object value) {
        typeof(T).GetRuntimeField(fieldName).SetValue(item,value);
   }
  </code></pre>