任何 .Net 语言中使用的 .Net 库?

发布于 2024-10-07 10:06:13 字数 214 浏览 5 评论 0原文

简单的问题,我一直在阅读一些有关 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

天气好吗我好吗 2024-10-14 10:06:13

任何程序集(IL 代码和清单)都可以在任何 .NET 语言中使用 - 无论它是用什么语言编写的,只要代码符合 CIL 并符合 CLS(通用语言规范)。

来自 MSDN (CLS):

为了与其他对象充分交互,无论它们是用什么语言实现的,对象必须仅向调用者公开那些它们必须与之交互操作的所有语言所共有的功能。为此,定义了公共语言规范(CLS),它是许多应用程序所需的一组基本语言特性。 CLS 规则定义了通用类型系统的子集;也就是说,适用于通用类型系统的所有规则都适用于 CLS,除非 CLS 中定义了更严格的规则。 CLS 通过定义一组开发人员可以依赖的可用于多种语言的功能来帮助增强和确保语言互操作性。 CLS 还制定了 CLS 合规性要求;这些帮助您确定您的托管代码是否符合 CLS,以及给定工具在多大程度上支持使用 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):

To fully interact with other objects regardless of the language they were implemented in, objects must expose to callers only those features that are common to all the languages they must interoperate with. For this reason, the Common Language Specification (CLS), which is a set of basic language features needed by many applications, has been defined. The CLS rules define a subset of the Common Type System; that is, all the rules that apply to the common type system apply to the CLS, except where stricter rules are defined in the CLS. The CLS helps enhance and ensure language interoperability by defining a set of features that developers can rely on to be available in a wide variety of languages. The CLS also establishes requirements for CLS compliance; these help you determine whether your managed code conforms to the CLS and to what extent a given tool supports the development of managed code that uses CLS features.

风吹短裙飘 2024-10-14 10:06:13

如果我正确理解你的问题,那么你可以使用 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.

善良天后 2024-10-14 10:06:13

互操作性存在限制。特别是如果不同语言底层的类型系统存在显着差异。但除了语法之外,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.

月亮邮递员 2024-10-14 10:06:13

我们在 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文