How to use an ASSEMBLY

M

michael

General:
- Using C#
- Using notepad to program (NOT Visual Studio).

I have a code-behind file name 'example1.cs'. I want to use an Assembly
given to me for a project I'm working on. I have put the assembly named
'assembly1.dll' in the /bin directory.

How do I import/load etc the assembly so that I can use it in example1.cs?

Thanks in advance
 
B

Bret Mulvey [MS]

michael said:
General:
- Using C#
- Using notepad to program (NOT Visual Studio).

I have a code-behind file name 'example1.cs'. I want to use an Assembly
given to me for a project I'm working on. I have put the assembly named
'assembly1.dll' in the /bin directory.

How do I import/load etc the assembly so that I can use it in example1.cs?

Thanks in advance

Use System.Reflection.Assembly.Load to load the assembly. After that, you
would typically use Assembly.CreateInstance to create an instance of one of
the classes in that assembly.
 
M

michael

So - how does that work ???

example.cs
----------------------------
System.Reflection.Assembly.Load assembly1.dll

public class ExampleClass {
AssemblyClass ac = Assembly.CreateInstance(assembly1.dll);
}
------------------------------------

please provide more code ... thanks for you help :)
 
P

Peter Koen

General:
- Using C#
- Using notepad to program (NOT Visual Studio).

I have a code-behind file name 'example1.cs'. I want to use an
Assembly given to me for a project I'm working on. I have put the
assembly named 'assembly1.dll' in the /bin directory.

How do I import/load etc the assembly so that I can use it in
example1.cs?

Thanks in advance

just add the namesapce(s) from that assembly with using to your source. and
when compileing add a /ref:assemblyname.dll to your compile settings.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top