任何 .Net 语言中使用的 .Net 库?
简单的问题,我一直在阅读一些有关 .Net 的内容,一些人的谈话方式对我来说意味着 .Net 库可以与多种 .Net 语言一起使用。也许这只是我的一厢情愿哈哈。例如,我可以使用以 C# 和 Boo .Net 语言编写的 Tai 框架吗?
我可以解释的唯一方法是,该库是否被编译为字节码以在 .Net 中运行,并且可以与任何也可以编译的语言一起使用。不过我对 .Net 不太了解 ^-^
谢谢
Quick question, I've been reading about some .Net stuff and the way some people talk implies on me that a .Net library could be used with multiple .Net languages. Maybe it's just wishful thinking on my part lol. For instance could I use the Tao Framework, programmed in C#, with the Boo .Net language?
The only way I could explain it is if the library is compiled to bytecode to run in .Net and can be used with any language that also compiles too. I don't know very much about .Net though ^-^
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
任何程序集(IL 代码和清单)都可以在任何 .NET 语言中使用 - 无论它是用什么语言编写的,只要代码符合 CIL 并符合 CLS(通用语言规范)。
来自 MSDN (CLS):
Any assmebly (IL code and manifest) can be used in any .NET language - it doesn't matter what language it was written in, so long as the code is CIL compliant and conforms to the CLS (Common Language Specification).
From MSDN (CLS):
如果我正确理解你的问题,那么你可以使用 C# 或 Delphi Prism 创建一个 .NET 库,将其编译为 IL 并获取程序集。然后您可以在 VB.NET 项目中引用和使用该程序集。
If I understood your question right, then you can create a .NET library in, say, C# or Delphi Prism, compile it to IL and get an assembly. Then you can reference and use this assembly in your VB.NET project.
互操作性存在限制。特别是如果不同语言底层的类型系统存在显着差异。但除了语法之外,Boo 和 C# 非常相似,因此它们之间应该没有问题。
There are limits to interoperability. In particular if the type system underlying different languages differs significantly. But Boo and C# are very similar apart from the syntax, so there should be no problems between these.
我们在 VB.Net 项目中使用 C# 帮助程序库,没有任何问题 - 单个项目只能处理单一语言,但解决方案可以包含多个项目,每个项目都使用自己的语言(或引用以任何语言编写的可编译为 MSIL 的任何程序集):完整的 VS 调试功能
We use C# helper libraries in our VB.Net project without issue - A single project can only handle a single language but a solution can contain multiple projects each using their own language (or reference any assembly written in any language that compiles to MSIL) with full VS debugging functionality