GetPropertyName via reflection

Reflection is very usefull, and most of the time it needed horrible (but precious!) code to write. No matter about class, helpers, static methods, extension methods, or whatever, that code was awful.

Because every developer is lazy, I was looking for a elegant way to use reflection and Expression, and found this ReflectionUtility that was the right one for me: How to get C# property names without magic strings – static reflection.

You can call it this way:
ReflectionUtility.GetPropertyName(() => myOrder.CustomerCode);

This post worth a read: How to get C# property names without magic strings – static reflection

😉

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: