title: Accessing C# property name or attributes
body: <p>I would like to automatically generate SQL statements from a class instance. The method should look like Update(object[] Properties, object PrimaryKeyProperty). The method is part of an instance (class, base method - generic for any child). Array of properties is an array of class properties, that will be used in <em>update</em> statement. Property names are equal to table field names.</p>
  
  <p>The problem is that I can't get property names.</p>
  
  <p>Is there any option to get a property name inside class instance?
  sample:</p>
  
  <pre><code>public class MyClass {
  public int iMyProperty { get; set; }
  public string cMyProperty2 { get; set; }
  {
  
  main() {
   MyClass _main = new MyClass();
  
  _main.iMyProperty.*PropertyName* // should return string "iMyProperty"
  
  {
  </code></pre>
  
  <p>I am aware of PropertyInfo, but I don't know hot to get the ID of a property from GetProperties() array.</p>
  
  <p>Any suggestion?</p>