Results 1 to 3 of 3

Thread: How to retrieve the methods from a dll?

  1. #1

    Thread Starter
    Lively Member hbandarra's Avatar
    Join Date
    Aug 2002
    Location
    Lisbon, PT
    Posts
    66

    How to retrieve the methods from a dll?

    How to retrieve the methods from a dll?

    Can I retrieve them using the System.Reflection.Assembly? How?

    Thanks!

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Code:
    System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom("myassembly.dll");
    Type[] types = assembly.GetExportedTypes();
    foreach(Type type in types)
    {
      string typename;
      if(type.IsClass)
        typename = "class";
      else if(type.IsValueType)
        typename = "struct";
      else if(type.IsEnum)
        typename = "enum";
      else
        continue;
      Console.WriteLine("Assembly defines a "+typename+" named "+type.FullName);
    }
    You could extend this thing using various methods of Type.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Or do you mean functions from a normal dll? Look up PInvoke in the reference.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width