Link to home
Create AccountLog in
Avatar of Rob Siklos
Rob SiklosFlag for Canada

asked on

Can I use reflection to discover if a property is auto-implemented?

I am using reflection in .NET 3.5, and I want to discover if a property of a class is implemented by the developer, or auto-implemented (

For instance, this property is implemented by the developer:
  private string myField = "";
  public string RegularProp {
     get { return myField;}
     set { myField = value; }

And this property is auto-implemented:

  public string AutoProp {get; set; }

Can anyone find a way to make the distinction between regular and auto-implemented properties using reflection?
Avatar of scuzzie
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Rob Siklos


Yes - I think you're right.