Jump to content

import online class library

- - - - -

  • Please log in to reply
1 reply to this topic

#1
paolodinhqd

paolodinhqd

    Newbie

  • Members
  • Pip
  • 5 posts
hi all,

i have a class library (dll) online and making a c# application.

what i want to do is
(1) download this dll during runtime
(2) and create an instant of a class in this class library

you guys have any idea? :confused:

#2
paolodinhqd

paolodinhqd

    Newbie

  • Members
  • Pip
  • 5 posts
i've finally found out how to make it happen using Assembly and InvokeMethod

eg.
using System;
using System.Windows.Forms;
using System.Reflection;

public class prova:Form {
  
  public static void Main() {
    Assembly Asm = Assembly.LoadFrom("d:/media_player.dll");
    Type player = Asm.GetType("media_player");
    object Player = Activator.CreateInstance(player); 
    player.InvokeMember("info",BindingFlags.InvokeMethod,null,Player,null);
  }
}





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users