更新时间:2023-11-08 11:26:28
你好,谢谢先生所说的绝对正确但是让我帮帮忙。
转到
文件菜单 - >新建 - >项目 - >类库模板,然后点击确定。
它将为您打开一个Class1.cs页面。
Hi there,whatever Sergey Sir told is absolutely right but let me help u out.
go to
File Menu->New->Project->Class Library template and click OK.
it will open a Class1.cs page for you.
public class Class1
{
public int Add(int a, int b)
{
return a + b;
}
}
现在构建你的项目。并使用Add Project添加另一个控制台应用程序选项卡。
和现在在您的控制台应用程序中添加ClassLibrary1的更新(转到参考 - >添加参考 - >浏览 - > ClassLibrary1Projoect-> bin-> debug-> ClassLibrary1。 dll)。
并在Program.cs页面上使用以下代码:
now build your project .And add another console Application using Add Project tab.
and now Add refresnces of ClassLibrary1 in your console Application(go to Refrences->Add Refrences->Browse->ClassLibrary1Projoect->bin->debug->ClassLibrary1.dll).
and use below code on Program.cs page:
using System;
using ClassLibrary1;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Class1 c = new Class1();
Console.WriteLine( c.Add(10, 16));
Console.ReadKey();
}
}
}
现在运行此ConsoleApplication以使用.DLL概念获取添加。
完成。
所以jmd
: - )
now run this ConsoleApplication for getting addition using .DLL concept.
Done.
so jmd
:-)