Microsoft.VisualBasic 命名空间是“真正的 .NET"吗?代码? [英] Is the Microsoft.VisualBasic namespace "true .NET" code?

查看:25
本文介绍了Microsoft.VisualBasic 命名空间是“真正的 .NET"吗?代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的开发团队正准备开始一个新项目.自 VB3 时代以来,这家商店一直是VB 商店",但现在流行的观点是我们是.NET 商店",而且由于 C# 是专门为 .NET 创建的,而 VB.NET 是一种改造,我们决定继续只写 C#.争议围绕 Microsoft.VisualBasic 命名空间在新开发中是否具有合法地位,或者它是否只是为了向后兼容 VB6(和更旧)代码的问题.另一个更有趣的问题是,Microsoft.VisualBasic 命名空间下"的代码是否甚至是 .NET 代码,如果它真的是旧的 VB 运行时,仔细打包在 .NET 包装器中,使其实际上成为 COM 互操作控件(类似于 WinForms 如何包装非 .NET Win32 窗口 API,但仅公开 .NET API 以供使用).

My dev team is getting ready to start a new project. The shop has been a "VB shop" since the days of VB3, but the prevailing opinion now is that we're a ".NET shop" and since C# was created specifically for .NET, whereas VB.NET was a retrofit, we've decided to move forward writing C# only. The controversy revolves around the question of whether the Microsoft.VisualBasic namespace has a legitimate place in new development or if it is only for backward compatibility for VB6 (and older) code. A further, and more interesting question is whether the code "under" the Microsoft.VisualBasic namespace is even .NET code of if it is really the old VB runtime carefully packaged in a .NET wrapper, making it in fact a COM interop control (similar to how WinForms wraps the non-.NET Win32 windowing API but exposes only .NET APIs for consumption).

更令人困惑的是,我们的开发团队有一位 Microsoft 咨询服务顾问告诉我们 Microsoft 不再支持 Visual Basic,包括 Microsoft.VisualBasic 命名空间下的 VB 运行时.

To make this even more confusing, our dev team has a Microsoft Consulting Services consultant telling us Microsoft no longer supports Visual Basic, including the VB runtime underlying the Microsoft.VisualBasic namespace.

我正在寻找的是链接——最好是指向无可挑剔的 Microsoft 资源——指向以一种或另一种方式明确回答这个问题的文档.我已经在 Google 上尝试了几种搜索排列方式,但还没有更接近这个问题的根源.

What I'm looking for are links -- preferably to unimpeachable Microsoft sources -- to documentation that definitively answers this question one way or the other. I've already tried several search permutations on Google and not gotten any closer to getting to the bottom of this question.

显然我没有把我的问题说清楚.我不是在问 VB.NET 是否是真正的 .NET 代码.我正在尝试确定 Microsoft.VisualBasic 命名空间下"的内容是否是 .NET 代码,或者它是否是精心打包并作为 .NET 代码公开的旧 VB6 运行时.有人已经说过,命名空间的 9/10 只是简单地包装了 .NET 中其他地方的代码;那另外的 1/10 呢?

Apparently I didn't make my question clear. I'm not asking if VB.NET is true .NET code. I'm trying to determine if whatever is "under" the Microsoft.VisualBasic namespace is .NET code or if it's the old VB6 runtime carefully packaged and exposed as .NET code. Someone already said that 9/10 of the namespace simply wraps code from elsewhere in .NET; what about that other 1/10?

推荐答案

Microsoft.VisualBasic.dll <> Microsoft.VisualBasic.Compatibility.dll !!!

(或者,如果您愿意,Microsoft.VisualBasic.dll != Microsoft.VisualBasic.Compatibility.dll;)

(or, if you prefer, Microsoft.VisualBasic.dll != Microsoft.VisualBasic.Compatibility.dll; )

Microsoft.VisualBasic.Compatibility 命名空间专供 VB6 升级向导使用,可能会在未来版本中删除,并且永远不应用于新开发.

The Microsoft.VisualBasic.Compatibility namespace is exclusively for use by the VB6 upgrade wizard, may be removed in future versions, and should not ever be used for new development.

Microsoft.VisualBasic 命名空间绝对是 100% 真正的 .Net,完全受支持,只要 .Net 存在,它就会存在.

The Microsoft.VisualBasic namespace is absolutely, 100% true .Net, fully supported, and will be around as long as .Net is around.

一些相关链接:

添加了来自这篇 MSDN 文章的官方词:

Visual Basic 运行时提供了全局的底层实现Visual Basic 函数和语言Len、IsDate 和CStr.虽然新的 Visual Basic运行时提供了类似的设施它的前辈,它完全是托管代码(在 VisualBasic .NET),在公共语言运行时.此外,Visual Basic 运行时是.NET Framework,所以它永远不会一些分开的东西,你的应用程序必须携带或部署.

The Visual Basic Runtime provides the underlying implementation for global Visual Basic functions and language features such as Len, IsDate, and CStr. And though the new Visual Basic Runtime provides similar facilities as its predecessors, it is entirely managed code (developed in Visual Basic .NET) that executes on the common language runtime. Furthermore, the Visual Basic Runtime is part of the .NET Framework, so it is never something separate that your application has to carry or deploy.

Visual Basic 6.0 兼容性库不同于 Visual基本运行时.这Microsoft.VisualBasic.Compatibility命名空间由工具使用将 Visual Basic 6.0 代码升级到Visual Basic .NET.它是一座桥梁支持 Visual Basic 6 功能.NET 不直接支持Visual Basic 的实现.不一样Visual Basic 运行时,兼容性库不是所有 Visual 隐式引用基本的 .NET 应用程序.当你将 Visual Basic 6 项目升级到Visual Basic .NET,升级向导添加对Microsoft.VisualBasic.Compatibility.

The Visual Basic 6.0 Compatibility library is distinct from the Visual Basic Runtime. The Microsoft.VisualBasic.Compatibility namespace is used by the tools that upgrade Visual Basic 6.0 code to Visual Basic .NET. It is a bridge to support Visual Basic 6 features that are not directly supported by the .NET implementation of Visual Basic. Unlike the Visual Basic Runtime, the compatibility library is not implicitly referenced by all Visual Basic .NET applications. When you upgrade a Visual Basic 6 project to Visual Basic .NET, the upgrade wizard adds a reference to Microsoft.VisualBasic.Compatibility.

兼容性类不应该用于新的开发.这Microsoft.VisualBasic.Compatibility命名空间增加了一层复杂性到您的 Visual Basic .NET 应用程序并介绍了一些最小的性能成本可能是通过重新编码部分消除应用.除此之外兼容性命名空间通常包含许多包装 COM 对象的类,并且如前所述,取决于COM 对象不如纯托管实现.

The compatibility classes should not be used for new development. The Microsoft.VisualBasic.Compatibility namespace adds a layer of complexity to your Visual Basic .NET application and introduces some minimal performance costs that could be eliminated by recoding portions of the application. In addition, the Compatibility namespace often contains many classes that wrap COM objects, and as stated earlier, depending on COM objects is not as optimal as a pure managed implementation.

这篇关于Microsoft.VisualBasic 命名空间是“真正的 .NET"吗?代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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