简体   繁体   中英

combine c# class and vb.net classes

I am using asp.net 2012 and have c# class project where I would like to include some existing vb.net classes.

What would be the best way to be able to use both c# and vb.net classes?

可以将vb.net类转换为C#,也可以将vb.net类放入其自己的程序集中并添加对该程序集的引用。

将VB.NET类放在自己的项目中,然后像引用任何第三方控件一样引用该项目。

As already mentioned, one of the alternatives is to convert c# to vb.net or vice-versa. You can find many pages in the internet to do that, like these ones:

http://www.developerfusion.com/tools/convert/vb-to-csharp/

http://www.developerfusion.com/tools/convert/csharp-to-vb/

If you convert the code from one language to the other make sure you test the changes properly.

If you decide to keep VB.NET code in a separate Visual Studio project and reference it in the C# code you need to ensure that the VB.NET code is CLS compliant. This is a good starting point:

Writing CLS-Compliant Code

See also:

Cross-Language Interoperability

Make C# a .NET library and include it in your VB.NET/ASP.NET project.

Follow this http://msdn.microsoft.com/en-us/library/t990ks23.aspx for more info...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM