title: How can I get a property name for a type without the need to instantiate an object of that type?
body: <p>I have a requirement where I need to have a "type safe" way of accessing property names, without actually instantiating an object to get to the property.  To give an example, consider a method that takes as arguments a list of IMyObject and a string that represents a property name (a property that exists in IMyObject).</p>
  
  <p>The methods implementation will take the list and access all the objects in the list using the property name passed... for some reason or another, we won't dwell on that!!</p>
  
  <p>Now, I know that you can do this using an instantiated object, something like ...</p>
  
  <pre><code>Dim x as MyObject = nothing
  Dim prop As PropertyInfo = PropHelper.GetProperty(Of MyObject)(Function() x.MyProperty)
  </code></pre>
  
  <p>Where my helper method uses reflection to get the name of the property as a string - there are numerous examples of this flying around on the web!</p>
  
  <p>But I don't want to have to create this pointless object, I just want to do something like MyObject.MyProperty!  Reflection allows you to iterate through a types properties and methods without declaring an object of that type... but I want to access a specific property and retrieve the string version of its name without iteration and without declaring an object of that type!</p>
  
  <p>The main point here is that although I am trying to get the property name as a string... this is done at run time... at compile time, I want this to be type safe so if someone changes the property name, the compilation will break.</p>
  
  <p>Can anyone help in this quest!?!</p>