Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

using .Net Reflector

BobLewistonBobLewiston Member Posts: 43
Please forgive what is surely a stupid question:

How do I use .Net Reflector to find out which namespace a class, method or property is in, or to see parameter lists? There's no way to enter a character string to tell it what you're looking for.

Comments

  • itdelphiaitdelphia Member Posts: 28
    Reflector is a technique, it is not realy a class. Actualy, there are ways to .... What you are looking for is Assembly class and Type class:
    [code]

    Assembly SampleAssembly;
    SampleAssembly = Assembly.LoadFrom("c:\Sample.Assembly.dll");
    // Obtain a reference to a method known to exist in assembly.
    MethodInfo Method = SampleAssembly.GetTypes()[0].GetMethod("Method1");
    // Obtain a reference to the parameters collection of the MethodInfo instance.
    ParameterInfo[] Params = Method.GetParameters();
    // Display information about method parameters.
    // Param = sParam1
    // Type = System.String
    // Position = 0
    // Optional=False
    foreach (ParameterInfo Param in Params)
    {
    Console.WriteLine("Param=" + Param.Name.ToString());
    Console.WriteLine(" Type=" + Param.ParameterType.ToString());
    Console.WriteLine(" Position=" + Param.Position.ToString());
    Console.WriteLine(" Optional=" + Param.IsOptional.ToString());
    }




    [/code]
Sign In or Register to comment.