C# Using Reflection to list object properties programatically

Hello World!
Today a fellow colleague asked me if it is possible to programmatically access the fields of a custom type and check if they are null or empty and take some action based on the test.
I knew this had to be solved by using reflection by determining the runtime “Type” and then enlist members. On research, found this useful link:
There are several (working!!) examples here that demonstrate the technique.
All the best!
Advertisements
Posted in Uncategorized

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

  • Comic for May 23, 2017
    Dilbert readers - Please visit Dilbert.com to read this feature. Due to changes with our feeds, we are now making this RSS feed a link to Dilbert.com.
%d bloggers like this: