想要用于类库功能以及如何实现名称空间的基本代码. [英] want basic code for class library function and how to implement namespace.

查看:63
本文介绍了想要用于类库功能以及如何实现名称空间的基本代码.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想要classlibrary.cs函数的基本代码以及如何实现namespace.my,我的第一个项目需要一些指导.

want basic code for classlibrary.cs function and how to implement namespace.my first project i need some guidense.

推荐答案

您可以创建一个类库Project,构建完成后,它将创建DLL,然后在其他项目中重用您的C#代码.
步骤:
File | New Project |选择模板类型"ClassLibrary"
这将有一个类文件,您可以使用相同/重命名或添加新文件.建立它.它将创建一个dll.
这是一步一步的指南,可能会为您提供帮助.
如何在C#.NET中创建类库 [
You can create a class library Project, Once it build, it will create DLL and then reuse your C# code in other projects.
Step :
File | New Project | Select Template Type "ClassLibrary"
This will have a class file, you can use the same / rename or add a new files. Build it. It will create a dll.
Here is one step by step guide, which may help you.
How to Create a Class Library in C# .NET[^]


实际上是在您开始创建新类库时项目,Visual Studio会在给项目的命名空间中为您添加第一个类,并设置项目属性.

因此,我建议您创建一个dll项目,并在进行任何修改之前,先研究一下已为您构建的模板,然后继续研究一些易于理解的小型解决方案的示例.
Actually when you start creating a new class library project, Visual studio will add the first class for you, in the namespace you give to the project and sets up the project properties.

So I suggest that you create a dll project and before making any modifications, investigate what the template already built for you and then move on to examples for small, easy-to-understand solutions.


这里没有基本代码"之类的东西.编写所需的代码.

同样,名称空间也不是需要实现"的东西.这只是您为名称空间选择的一些(有效)名称,放在名称空间声明中,并将您的类型放在一个或另一个名称空间下.它不影响任何功能,仅用于不同类型具有相同的简单名称,由于名称空间定义了不同的完全限定名称,因此解析为不同的名称.

—SA
There is no such thing as "basic code" here. Write the code you want.

Also, namespaces is not something which needs "implementation". This is just some (valid) name you choose for your namespaces, put in namespace declaration and put your types under one or another namespace. It does not affect any functionality whatsoever, used just to have identical simple names for different types, resolved as different thanks to different fully-qualified names defined by the namespaces.

—SA


这篇关于想要用于类库功能以及如何实现名称空间的基本代码.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆