想要用于类库功能以及如何实现名称空间的基本代码.

编程入门 行业动态 更新时间:2024-10-16 22:24:41
本文介绍了想要用于类库功能以及如何实现名称空间的基本代码.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

想要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

更多推荐

想要用于类库功能以及如何实现名称空间的基本代码.

本文发布于:2023-11-07 19:34:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567230.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何实现   类库   名称   代码   功能

发布评论

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

>www.elefans.com

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