Reflection

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

Hello

I'm still what you'd consider to be a newbie to c# Can anyone provide an
explanation to reflection, when, why it's used, and benefits or show an
example.

Thanks
 
Jason,

Reflection is the process of getting information about the structure of
types. So you can get a class that represents a type (say, like String,
Int32, etc, etc) and then it will tell you all of the details about that
type. It will tell you about properties, methods, etc, etc, and give you
methods to create new instances, invoke methods, and other things of that
nature.

Reflection is used in a number of areas in the framework, most notably
in serialization (it iterates over all the fields and then stores the
contents of those fields in a stream) and in databinding (it will get the
property that has the name that you give it, and then get the value of it).

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top