开发者

Project with mixed languages in .NET

开发者 https://www.devze.com 2023-03-02 22:41 出处:网络
I’m not sure if what I am trying to do is possible, but surprisingly VS2008 seems to let me copy a .cs file directly into my VB.NET project.I then thought that I may be able to use the class in this

I’m not sure if what I am trying to do is possible, but surprisingly VS2008 seems to let me copy a .cs file directly into my VB.NET project. I then thought that I may be able to use the class in this file开发者_JAVA技巧 directly from VB.NET. However, it doesn’t see it when I try to reference it in. Is what I'm trying to do possible, or is VS2008 simply treating the C# file as a resource file or something?


You should reference CS project that contains your class written in C# from your VB project. This class should be public. After doing it, you will be able to use this class in your VB project.


You'll need to add a C# project to the solution, rather than just copying the source file. Just create a new project making sure you select it as a C# class library or similar and make sure you add it to the current solution and then copy the source file into that.


Maybe you want the c# code translated into vb, then be sure to have a look at http://converter.telerik.com/ there are many code converter but is the best I know.

0

精彩评论

暂无评论...
验证码 换一张
取 消