问题描述
我看过很多文章,它们在C#程序中使用VB我的命名空间",但无法使其对我有用.
我已经按照MSDN网站上的说明进行操作:
msdn.microsoft.com/zh-CN/library/ms173136.aspx,
我已将对Microsoft.VisualBasic.dll的引用添加到我的C#中,并且还使用以下语句添加了该引用:
使用My = Microsoft.VisualBasic;
MSDN文章建议使用此using语句:
使用Microsoft.VisualBasic.Devices;但这(设备"部分)会导致错误.
我希望我能够编写如下代码:
My.Computer mc =新的My.Computer();但这会导致错误(计算机部分).
键入我的"时出现的唯一智能信息.是"VBCodeProvider".
请帮助我理解为什么启用My Namespace尽管对MSDN进行了记录,但对我却不起作用,并且许多其他人都曾成功使用过它.
在VS2008和VS2010中已经尝试过了.
感谢您的帮助.
Ron Breen
I have viewed many articles for using the VB "My Namespace" in a C# program but cannot get it to work for me.
I have followed the instructions hat MSDN web site:
msdn.microsoft.com/en-us/library/ms173136.aspx ,
I have added a reference to Microsoft.VisualBasic.dll to my C# and also added this using statement:
using My = Microsoft.VisualBasic;
The MSDN article recommends using this using statement:
using Microsoft.VisualBasic.Devices; but this (the Devices portion) causes an error.
I expected that I would be able to write code like this:
My.Computer mc = new My.Computer(); but this causes an error (the Computer portion).
The only intellisense information that appears when I type "My." Is "VBCodeProvider".
Please help me understand why enabling the My Namespace will not work for me though it is documented in MSDN and many posts have been made by others whou have used it successfully.
Have tried this in VS2008 and VS2010.
Thanks for your help.
Ron Breen
推荐答案
这篇关于在C#中使用VB MyNamespace的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!