在C#.net程序中创建dll

编程入门 行业动态 更新时间:2024-10-26 18:23:49
本文介绍了在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

本文发布于:2023-11-06 22:25:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564841.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:程序   net   dll

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!