Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.






Is Automatic Property Same as Property?

I was listening one session on TechEd (night after long party, yeah) and I was thinking about automatic properties - are they really exact equivalent to usual properties? Something made me suspicious, so I opened my laptop at first free moment and checked out what's going on.


NB! This blog is moved to

Click here to go to article


Paymon said:

It depends.

If the field that holds the value needs to be used inside the class very frequently, then performance-wise, automatic property is not the answer:

Every single "Get" means calling a getter method, pushing on the stack, etc.

# March 14, 2008 10:00 AM

Lee said:

Is it a significant performance hit to the getter every time you need to reference the value? Just curious, I haven't done any benchmarking or anything.

# March 18, 2008 5:08 PM

Manish Batra said:

Looking closely to the Disassembler, compiler has created a private instance "k__BackingField" by itself for automatic property. This way, we have increased the compiler overhead and shouldn't be considered under best practice.

# January 15, 2010 4:54 AM