Get Method Paramemters : Reflection Assembly « Development Class « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » Development Class » Reflection AssemblyScreenshots 
Get Method Paramemters
Get Method Paramemters


using System;
using System.Reflection;


public class Test
{
    public static void Main(string[] args)
    {
    Assembly a = null;
        AssemblyName asmName;
      asmName = new AssemblyName();
      asmName.Name = "Test";
      Version v = new Version("1.0.454.30104");
      asmName.Version = v;
 
        a = Assembly.Load(asmName);

    Type testClassName = a.GetType("Test");
    MethodInfo mi = testClassName.GetMethod("Main");  
    Console.WriteLine("Here are the params for {0}", mi.Name);
 
    // Show number of params.
    ParameterInfo[] myParams = mi.GetParameters();
    Console.WriteLine("Method has {0} params", myParams.Length);
    
    // Show info about param.
    foreach(ParameterInfo pi in myParams)
    {
      Console.WriteLine("Param name: {0}", pi.Name);
      Console.WriteLine("Position in method: {0}", pi.Position);        
      Console.WriteLine("Param type: {0}", pi.ParameterType);
    }
    }
}



           
       
Related examples in the same category
1.Get type infomation: base type, is abstract, is com object, is sealed, is classGet type infomation: base type, is abstract, is com object, is sealed, is class
2.Get all methods from a classGet all methods from a class
3.Get all fields from a classGet all fields from a class
4.Get all properties from a classGet all properties from a class
5.Get all implemented interface from a classGet all implemented interface from a class
6.Using reflection to get information about an assembly
7.Demonstrate using Type class to discover information about a classDemonstrate using Type class to discover information about a class
8.Demonstrate dynamically invoking an object
9.Locate an assembly, determine types, and create an object using reflection
10.Utilize MyClass without assuming any prior knowledge
11.Uses reflection to show the inherited members of a classUses reflection to show the inherited members of a class
12.Uses reflection to execute a class method indirectlyUses reflection to execute a class method indirectly
13.Deeper Reflection: Invoking Functions
14.Illustrates runtime type invocation
15.Illustrates unloading an application domain
16.Demonstrate typeofDemonstrate typeof
17.Create an object using reflectionCreate an object using reflection
18.Uses an object in another application domain
19.Illustrates creation of an application domainIllustrates creation of an application domain
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.