This is not quite a correct question. The request for "all various scenarios" is just ridiculous. The answer would be: the number of those scenarios in infinite, not no more than countable. And the length of the text of the "Quick Answer" listing each of scenarios would be infinite. Care to try? :-)
Reflection is a huge field of programming. To me, it the question looks the same as someone asked you : I want to know all the scenarios using a class. Or a function. Are you getting the picture?
So, you can only get a general idea. First of all, you need to get an idea of the concept of meta-data. Basically, if you don't know the role of meta-data and Reflection, you have no idea of .NET programming. Ever used serialization? Serialization is not possible about the types of the object being serialized. How can it be possible? The objects keep information of the type, via
object.GetType()
, and the type
System.Type
keeps all the information on the type: all members, attributes, all their type, and so on, recursively.
How do you think
PropertyGrid
can work? You only pass a reference to an object. How this components knows the structure? Through Reflection.
The Reflection is the base of any kinds of plug-ins. Please see my past answers on this topic:
Create WPF Application that uses Reloadable Plugins...[
^],
AppDomain refuses to load an assembly[
^],
code generating using CodeDom[
^],
Create WPF Application that uses Reloadable Plugins...[
^],
Dynamically Load User Controls[
^],
C# Reflection InvokeMember on existing instance[
^],
Projects and DLL's: How to keep them managable?[
^].
Please see the overview:
http://en.wikipedia.org/wiki/Metadata[
^],
http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29[
^].
—SA