C#控制台应用程序到dll [英] C# console application to dll

查看:418
本文介绍了C#控制台应用程序到dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有c#代码初始化力反馈操纵杆并播放力效果文件。我想将这个c#console应用程序更改为dll文件,以便我可以在labview中使用它。 http://stackoverflow.com/questions/24839498/converting-ac- sharp-console-app-to-a-dll [ ^ ]



我从这篇文章中了解到,我只需要创建一个类库和复制粘贴我的代码,这是真的吗?我只是这样做了一个dll文件。如果我错了你可以解释如何将控制台应用程序转换为DLL吗?

I have c# code that initializes a force feedback joystick and plays force effect file. I want to change this c# console application into a dll file so that I can use it in labview. http://stackoverflow.com/questions/24839498/converting-a-c-sharp-console-app-to-a-dll[^]

What I understood from this post is that I just need to create a class library and copy paste my codes there, is this true? I did get a dll file by just doing that. If I'm wrong can you explain how to convert a console application to a dll?

推荐答案

基本上是。

创建一个类库项目,它将创建一个DLL文件而不是EXE。



如果您将代码粘贴到新项目中(显然适当地更改命名空间)然后DLL将继续你的代码。除了Main方法之外,哪些DLL文件没有,因为它们不能直接执行。
Yes, basically.
Create a Class Library project, and it will create a DLL file instead of an EXE.

And if you paste your code into the new project (changing the namespace appropriately, obviously) then the DLL will continuation your code. Except for the Main method, which DLL files don't have as they are not directly executable.


这是真的。你的类库被转换为dll,你可以在其他项目中使用它。
It is true.Your class library is converted to dll which you can use in other projects.


是的,你可以。



建立一个新项目并选择类库,然后简单地将所有代码放入公共场所class并将其用作任何其他库。
Yes, you can.

Build a new project and choose Class Library, then simply put all you code into a public class and use it as any other library.


这篇关于C#控制台应用程序到dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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