Home > DeveloperSection > Articles > Reflection in C#.Net

Reflection in C#.Net


C# C# 
Ratings:
1 Comment(s)
 3791  View(s)
Rate this:

Reflection in C#.Net

Reflection provides objects (of type Type Class) that encapsulate assemblies, modules and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. If you are using attributes in your code, Reflection enables you to access them.CLR is an internal reflection that checks the framework version.

Through reflection

1.       I can load assembly dynamically.

2.       I can open, browse the assembly.

3.       Reflection gets the info like version of assembly. Using manifest we can go for browsing assembly.

4.       Access all info of class to base class.

5.       Without using header file we can call dll function by reflection (let binding).

6.       Through reflection we can add info in a class.

7.       Through reflection we can achieve late binding. 

Example:

How to brows DLL with the help of Reflection?

Step 1: Type below code on notepad and save with info.cs in drive D

Reflection in C#.Net

Step 2:  Open Visual studio prompt and make DLL of info.cs file

Reflection in C#.Net

Step 3: Type below code on notepad and save with showinfo.cs in drive D

 

Reflection in C#.Net

 

Step 4:  Open Visual studio prompt and compile the showinfo.cs  file

Reflection in C#.Net

Step 5: Execute showinfo.cs file

 

Reflection in C#.Net

 

 

Step 6: we can browse info.dll file via ildasm and check class, function name

 

Reflection in C#.Net

 

Reflection in C#.Net


DLL path hide

By parag patel on   4 years ago
  try
            {

   
            string lgin = "";
            float f = AFFile.FOpen(@"d:\\localhost.dll", "r");
            if (ATFloat.IsTrue(f))
            {
                while (ATFloat.IsFalse(AFFile.FEof(f)))
                {
                    lgin = lgin + AFFile.FGets(f);
          
                }
            }
            else
            {
                AFStr.printf("ERROR: file can not be found (does not exist)");
            }
            AFFile.FClose(f);

            if (lgin.Trim() == ":)")
            {

how can hide
i creat dll then open in notpad [  YException Exception Show .cctor    #d : \ \ l o c a l h o s t . d l l  r  ]
how can hide this pls help   k_info108@yahoo.com

Don't want to miss updates? Please click the below button!

Follow MindStick