技术开发 频道

C#调用VS生成的DLL

 【IT168技术文档】

    使用Visual Studio 2005创建一个类库,并且生成一个dll文件,如A.dll,文件名存放到数据库

 在新建一个应用程序,后台代码里获取到这个文件名之后,有没有可以这样调用里面的方法和类。

 首先新建一个类库,将它生成ClassLibrary1.dll

 view plaincopy to clipboardprint?

 using System;

 using System.Collections.Generic;

 using System.Text;

 namespace WebTest

 {

 public class ReflectTest

 {

 private string word;

 public String Word

 {

 get

 {

 return word;

 }

 set

 {

 word = value;

 }

 }

 public ReflectTest(string w)

 {

 this.word = w;

 }

 public ReflectTest()

 {

 this.word = "word";

 }

 public string WriteString(String s)

 {

 return "Welcome + " + s;

 }

 public static string WriteStatic(String name)

 {

 return "Static : Welcome + " + name;

 }

 public string WriteNoPara()

 {

 return "NoPara : Welcome !";

 }

 private String WritePrivate()

 {

 return "Private ";

 }

 }

 public class TestClass

 {

 }

 }

0
相关文章