title: FieldInfo for Specific Member
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/491429/how-to-get-the-propertyinfo-of-a-specific-property">How to get the PropertyInfo of a specific property?</a>  </p>
  </blockquote>
  
  
  
  <p>I have a class in C# with a public member. For example:</p>
  
  <pre><code>public class Foo
  {
      public int Bar;
  }
  </code></pre>
  
  <p>I'd like to get the FieldInfo for Bar, without having to do:</p>
  
  <pre><code>return this.GetType().GetField("Bar");
  </code></pre>
  
  <p>I'm just looking for a cleaner, shorter way to do this. Something like:</p>
  
  <pre><code>return field(Bar);
  </code></pre>
  
  <p>I could, of course, build a method:</p>
  
  <pre><code>public FieldInfo field(string name)
  {
       return this.GetType().GetField(name);
  }
  </code></pre>
  
  <p>I was just wondering if C# had something built-in for this sort of code. Something that would check at compile-time, since the above method will cause a run-time error if I misspell the field's name.</p>