VB.NET 2K8:如何让一个类中的所有可见的进口? [英] VB.NET 2K8: How to make all imports visible within a class?

查看:151
本文介绍了VB.NET 2K8:如何让一个类中的所有可见的进口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一般来说,常见的VB.NET类应如下所示:

Generally speaking, a common VB.NET class should look like the following:

Public Class MyClassName

End Class

此外,我已经看到了,如果我没记错的话,所有的导入语句,就像在C#中可见的:

Besides, I have already seen, if I remember correctly, all of the import statements visible just like in C#:

Imports System
Imports System.Data
Imports System.Linq

Public Class MyClassName

End Class

如何使用Visual Studio 2008在VB.NET使这些默认进口默认可见?

How to make these default imports visible by default in VB.NET using Visual Studio 2008?

有一些设置,或者是像我设置的选项?

Is there some setting or the like in the options I shall set?

谢谢! =)

推荐答案

好问题。在VB.NET语言规范中,只提到隐性进口没有给一个权威的榜单。我可以在命令行反向工程如图所示的输出窗口,VS2008和VS2010使用该/导入命令行选项:

Good question. The VB.NET Language spec only mentions "implicit imports" without giving an authoritative list. I can reverse-engineer it from the command line as shown in the output window, VS2008 and VS2010 uses this /Imports command line option:

  • Microsoft.VisualBasic程序,
  • 系统,
  • System.Collections中,
  • System.Collections.Generic,
  • System.Data这,
  • System.Diagnostics程序,
  • System.Linq的,
  • System.Xml.Linq的

的MSBuild从导入变量Microsoft.VisualBasic.targets设置这些。这是在.vbproj文件中设置:

MSBuild sets these in Microsoft.VisualBasic.targets from the Import variable. Which is set in the .vbproj file:

  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
    <Import Include="System.Collections" />
    <Import Include="System.Collections.Generic" />
    <Import Include="System.Data" />
    <Import Include="System.Diagnostics" />
    <Import Include="System.Linq" />
    <Import Include="System.Xml.Linq" />
  </ItemGroup>

变更项目+参考设置的没有的改变这一名单,但没有明显的一对一一对应,因为此画面变化的组装的引用文件,其&LT;进口&GT; 打造变量列表名称空间。我得踢,这最终是由项目模板决定的。

Altering the Project + Reference setting does alter this list but there's no obvious one-to-one correspondence since this screen changes assembly references, the <Import> build variable lists name spaces. I'll have to punt, this ultimately is determined by the project template.

这篇关于VB.NET 2K8:如何让一个类中的所有可见的进口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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