简体   繁体   中英

Use VB Library that made by VB Net in C#

Sometimes we meet some code of VB.net that doesn't support on C#, such as Mid, AscW,Asc, Right, Left .. etc so that i have made the Libraries that made by VBnet. well, my question is simple

is this going to get any problem? if i'm developing with 2 language of NET?

You can import .net libraries into any other .net language project. Not a problem.

我认为这个页面(跨语言互操作性)可能对您有所帮助。

There's no problem. Just add a reference to Microsoft.VisualBasic and use the functions in your C# code. More discussion of the pros and cons in this question

Alle .net languages can be used with each other - there should be no problem. But I would check VB.net code with "mid" etc. VERY carefully, that are old deprecated VB 6 style functions - there is a huge change that the programmer did not change his programming model as needed.

Both those .net languages (all I think) compile to CLI . An intermediate language between machine code and C#/VB.NET.

When you link to a managed DLL it makes no difference what the source language is, the resulting DLL code is the same. Indeed many reflectors (that show a source code representation of a managed DLL's code) have an option to choose the source code language.

Hence, you can link to any managed DLL created from any .net language, using it in any (other) .net language.


If you are only making a library using VB.NET because of functions like Mid , Left , Right etc. you might want to just research the C# equivalents or just code them in C#.

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