使用VB.NET和C#中的同一个应用程序? [英] Use VB.NET and C# in the same application?
问题描述
我开发的MS Visual Studio 2005中基于GUI的应用程序,我只是想
知道是否有可能在同一个项目中同时使用VB.NET和C#。或者,我可以包括C#编写的在我的VB.NET工程模块?
I am developing a GUI based application in MS Visual Studio 2005, I just want to know if it is possible to use both VB.NET and C# in the same project. Or can I include a module written in C# in my VB.NET project?
我在C#编写的类,我想在我的VB.NET基于项目来使用,所以如果我可以包含并呼吁从该项目的功能比我不会在VB.NET重新写入类。
I have a class written in C# which I want to use in my VB.NET based project, so if I can include and call functions from that project than I won't have to write the class again in VB.NET.
所以,请帮助我,因为我是新来的.NET编程。
So please help me as I am new to .NET programming.
推荐答案
我从来没有做过它自己,但我知道你可以编译C#code为DLL,然后加载并引用DLL在VB项目。
I've never done it myself, but I know you can compile the C# code into a dll and then load and reference the dll in your VB project.
我认为你要到C#code
使用时必须编译为一个DLL。一旦
做到这一点,简单的添加引用
该项目到你的VB.Net
项目,导入你的命名空间
需要,然后你可以使用C#
code。
I think the C# code that you want to use must be compiled as a DLL. Once that is done, simple add a reference to that project to your VB.Net project, import the namespace you need, and then you can use the C# code.
另请参阅如何:创建和使用C#DLL的(从MSDN,为VS2005)
Also see How To: Create and Use C# DLLs (from MSDN, for VS2005)
这篇关于使用VB.NET和C#中的同一个应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!