我可以将Visual Basic应用程序链接到C#吗?

编程入门 行业动态 更新时间:2024-10-25 16:26:56
本文介绍了我可以将Visual Basic应用程序链接到C#吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好, 我只是想知道我有一个用C#编写的程序和用Visual Basic编写的其他三个程序。那么我可以单独编译所有程序,在C#中添加它们并链接表格吗? 问候 Aman Chaurasia 我尝试了什么: 我还没试过,因为我想知道是否是否有可能。

Hello, I just wanted to know that I have a program written in C# and three other programs written in Visual Basic. So can I compile all the programs separately, add them in C# and link the forms? Regards Aman Chaurasia What I have tried: I have not tried yet because I wanted to know if it is possible or not.

推荐答案

是的,前提是这些应用程序都是为.NET编写的(即VB代码是在V6.0之后)。 .NET应用程序都生成.NET程序集文件,其中包含可以从任何.NET语言访问的中间代码,并使用它们使用相同的语言。 您所要做的就是添加DLL或EXE汇编文件作为C#项目的引用,您将可以访问VB表单,就好像它们是用C#编写的那样。 请注意,并非所有EXE或DLL文件都是.NET程序集:这些扩展也用于其本机代码等价物,根本无法引用,但必须通过DL访问LImport,一种更复杂的方法。 Yes, provided the apps are all written for .NET (i.e. the VB code is after V6.0). .NET applications all produce .NET Assembly files, which contain intermediate code that can be accessed from any .NET language and used as if it was in the same language. All you have to do is add the DLL or EXE assembly files as references to your C# project and you will have access to the VB forms as if they were written in C# orginaly. Do note that not all EXE or DLL files are .NET assemblies: these extensions were also used for their Native code equivalents, which cannot be referenced at all but must be accessed via DLLImport, a much more complex approach.

更多推荐

我可以将Visual Basic应用程序链接到C#吗?

本文发布于:2023-11-15 16:34:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1596129.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   链接   Visual   Basic

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!