VB.NET等同于C#的使用指令 [英] VB.NET equivalent to C#'s using directive

查看:123
本文介绍了VB.NET等同于C#的使用指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我把一些代码,从C#到VB.NET,我需要知道相当于是做什么用的C#中使用指令



更新:很抱歉,但到目前为止,我还没有得到我的答案。这里是一个C#示例:

 使用moOutlook = Microsoft.Office.Interop.Outlook;使用moExcel =的Microsoft.Office.Interop.Excel 
;

命名空间ReportGen
{
类报告


解决方案

您正在寻找的进口声明。将任何import语句,你需要在你的代码文件的顶部,就像在C#中的使用指令:





<预类=lang-vb.net prettyprint-覆盖> 进口moOutlook = Microsoft.Office.Interop.Outlook
进口moExcel = Microsoft.Office.Interop这里.Excel

命名空间ReportGen
类公共报告
'你的代码
端类
端命名空间


I am converting some code from C# to VB.NET, and I need to know what the equivalent is for C#'s using directive.

Update: Sorry, but so far I haven't gotten my answer. Here is a C# example:

using moOutlook = Microsoft.Office.Interop.Outlook;
using moExcel = Microsoft.Office.Interop.Excel;

namespace ReportGen
{
    class Reports

解决方案

You're looking for the Imports statement. Place any import statements that you need at the very top of your code file, just like the using directive in C#:

Imports moOutlook = Microsoft.Office.Interop.Outlook
Imports moExcel = Microsoft.Office.Interop.Excel

Namespace ReportGen
   Public Class Reports
      'Your code here
   End Class
End Namespace

这篇关于VB.NET等同于C#的使用指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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