本文介绍了在C#程序中创建dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能给我一个例子,说明如何为c#创建dll以及如何在其他程序或项目中使用该dll? 谢谢 我已经尝试过Abhinav链接,然后使用一个类库文件,方法是Add
Hi, Can anybody give me an example how I can create a dll for c# and how I can use the dll in other programs or projects? Thanks I have tried after Abhinav link then use a classlibrary file and method is Add
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace math { public class AddClass { public static int Add(int x,int y) { return(x+y); } } }和这样的主块
and main block like this
using System; using System.Collections.Generic; using System.Linq; using System.Text; using math; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int a = 2, b = 3; int add = AddClass.Add(a , b); Console.WriteLine("total", add); } } }错误是具有库输出类型的项目无法直接启动 ?? 告诉我哪里错了吗?
Error is A project with an output type of library can not be started directly?? tell me where is wrong??
推荐答案请参见此处 [ ^ ].
更多推荐
在C#.net程序中创建dll
发布评论