是否可以从用VB编写的类中调用用c#编写的函数,反之亦然? [英] Is it possible to call a function written in c# from a class written in VB or vice versa?

查看:98
本文介绍了是否可以从用VB编写的类中调用用c#编写的函数,反之亦然?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我们正在从事一个项目.有些人在C#中很擅长,有些人在vb中很擅长,所以我们是否有可能在不同的lang中编码我们的模块,并且可以互相调用函数?
如果是,怎么办?

Actually we are working on a project. Some guys are good in C# some in vb so is it possible we code our modules in different langs and can call functions of each other?
If so how?

推荐答案

是的.在VS2010中,同一解决方案中可以包含多种语言类型的项目.在所有版本中,您都可以使用一种语言创建二进制文件,然后从另一种语言引用它们.

干杯.
Yes. In VS2010 you can have projects of multiple language types in the same solution. In all versions you can create binaries in one language and reference them from another.

Cheers.


是的.这就是.NET背后的全部想法.最简单的方法是编写代码并将其编译为Class Libraries.然后,您可以从客户端代码使用此库.例如,您可以在VB.NET中编写代码并将其编译到类库中.然后,您可以用C#编写Windows应用程序,并使用Windows应用程序中类库中的函数.
Yes of course. That''s the whole idea behind .NET. The easiest way is to write your code and compile them to Class Libraries. You can then consume this library from your client code. For example, you can write code in VB.NET and compile it into a Class Library. You can then write a Windows application in C# and use the functions from the Class Library in your windows app.


是的.将您的代码放入DLL中,并让他们引用它(反之亦然).

这是我拒绝在某处工作的主要原因.主要的高级"程序员使用VB,并且知道我是C#程序员.他们问我不再使用C#是否可以.
我问了几个后续问题,他们显然不明白.Net到底是什么
Yes. Put your code into a DLL and have them reference it (or vice versa).

This was a main reason I refused to take a job somewhere. The main ''senior'' programmers used VB and knew I was a C# programmer. They asked me if I would be OK with not using C# anymore.
I asked a few follow up questions and they clearly did not understand what .Net really was


这篇关于是否可以从用VB编写的类中调用用c#编写的函数,反之亦然?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆