FieldInfo

Did you know that you could get every information on fields contained in a class ? I didn’t know I could…. I should have googled it 6 months before….  😦

FieldInfo[] fields = this.GetType().GetFields();

foreach (FieldInfo fi in fields)
{
Console.WriteLine(fi.Name);
}

Yeah, I’m still a beginner… And I didn’t know about reflexion ! Shame on me !

I need to refactor every gridview in which I put editable data. It’ll make the code more modular (right now each editable parameter registers itself).
I was wondering how to make a generic Clone function. Without using the reflexion, it’s IMPOSSIBLE !

Let’s code.

Advertisements

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