{%Pragmatic Coding%} Tips and tricks for software developers.

18Dec/120

What’s new in reflection for .NET 4.5

.NET 4.5 has some changes to the System.Reflection. The most significant is that the Type is now separated into two classes: Type and TypeInfo. TypeInfo object keeps a complete definition, and the Type now keeps only general information. If you use the reflection from your desktop or web applications for NET 4.5, then the old API is still available too, along with new reflections. Today I will focus on how to use some of the main features of the new API.  Read the full article...

12Dec/120

How To: Get property value from string using reflection in C#

Few days ago I had to implement selection of a list of items with filtering and fields I had to filter by has been passed as a string value.
Will give you sample function where I have implemented filtering.

As you can see I'm using GetPropValue function that uses Reflection to get object property value.
Here is GetPropValue function implementation:

I hope this post was helpful for you!
Post a coment if you have any questions!