在C#中支持VB.NET的导入命名空间功能 [英] Support for VB.NET's Imported Namespaces feature in C#
问题描述
我已经习惯了VB.NET.我正在学习的游戏源代码是用C#编写的.我觉得很烦,我必须在源代码中添加using System.Diagnostics
才能键入Debug.WriteLine...
.我在项目属性下进行了检查,但是找不到引用"选项卡,该选项卡允许我将名称空间添加到导入的名称空间".在C#中我可以在哪里找到它?
I am use to VB.NET. The game source code I am learning from is written in C#. I find it annoying that I have to add using System.Diagnostics
to the source code in order to type Debug.WriteLine...
. I checked under project properties, but I cannot find the References tab that allows me to add namespaces to Imported Namespaces. Where do I find this in C#?
此外,为什么我不能在C#中执行此操作? Imports System.Math
Also, why can't I do this in C#? Imports System.Math
推荐答案
我认为您不能像在VB.NET中那样在C#中拥有隐藏"的命名空间(不确定).
I don't think you can have "hidden" namespaces in C# like you can in VB.NET (not sure).
关于System.Math的第二部分,您可以在每个文件的顶部执行以下操作.
As for the second part about System.Math, you can do the following at the top of each file.
using SM = System.Math;
SM.Abs(...);
这篇关于在C#中支持VB.NET的导入命名空间功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!