none
DLL的问题 RRS feed

  • 问题

  • vs上新建项目有类库,我就建立了一个,头一次干这个,第一个问题是我编写的类中函数可以有Console.Write等对控制台下的语句吗?

    类中可以有Main吗?

    还有导入引用怎么写?

    2018年8月25日 1:55

答案

  • Hi,

    .NET Framework 类库是一个包含类,接口和值类型的库,可以提供对系统功能的访问。 它是构建.NET Framework应用程序,组件和控件的基础。

    类库是没有入口函数的,也就是你说的Main函数,但是可以有Console.Write这样的语句,用来输出一些结果。

    当你写完一个类库以后想要在其他项目引用的时候,你首先需要把这个类库编译,这样会在(工程)/bin/debug目录下生成一个.dll的文件,你只需要将这个.dll当成一个普通的程序集添加到程序的引用(Reference)即可。

    这里有一些参考文章:

    .NET Framework Class Library

    Creating Class Library in Visual C#

    Regards,

    Stanly

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • 已建议为答案 Aileen--1024 2018年8月27日 8:06
    • 已标记为答案 czhch 2018年8月28日 0:59
    2018年8月25日 8:19