what is System.Reflection

Posted by Shivanichhabra4u under ASP.NET on 6/3/2010 | Views : 17297 | Status : [Member] | Replies : 5
Can anybody explain me in simple terms what is System.Reflection




Responses

Posted by: Raja on: 6/3/2010 [Member] Starter

Up
0
Down
Just go through this link and you know Reflection

http://www.dotnetfunda.com/interview/exam2208-what-is-reflection.aspx
http://www.dotnetfunda.com/interview/exam81-what-is-reflection.aspx

Regards,
Raja, USA

Shivanichhabra4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Susantaown on: 6/4/2010 [Member] Starter

Up
0
Down
System.Reflection

When ever we compile our code in .net frame work we are getting dll , in order to see the what short of methods, constructor, parameters we are using in that method at run time we are using system.reflection. we have to use gettype(), or typeof to know details about that dll.
or we can say
System.Reflection namespace is going to work with assembly and metadata.

[code]

using System;
using System.Reflection;


static void Main(string[] args)
{
string sAssemblyName = GetValidAssembly(args);
Assembly asm = Assembly.LoadFrom(sAssemblyName);

Type[] types = asm .GetTypes();

foreach (Type t in types)
{
try
{
Console.WriteLine("Namer:" + t.FullName);
Console.WriteLine("\tIs Class = " + t.IsClass);
Console.WriteLine("\tIs Enum = " + t.IsEnum);
Console.WriteLine("\tAttributes = " + t.Attributes);
}
catch (Exception ex)
{
Console.WriteLine("ex.Message");
}
}
}
[/code]

Shivanichhabra4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/1/2011 [Member] Bronze | Points: 25

Up
0
Down
good explanation "Susantaown"

Regards
Akiii

Shivanichhabra4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 6/1/2011 [Member] Starter | Points: 25

Up
0
Down
try this

http://www.codeguru.com/csharp/csharp/cs_misc/reflection/article.php/c4257

Thanks&Regards
LakshmiNarayana Nalluri.

Shivanichhabra4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Susanthampy on: 6/1/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down

Login to post response