我可以从linqpad查询中删除命名空间导入吗? [英] Can I remove a namespace import from a linqpad query?
问题描述
我正在尝试运行linqpad查询,但是默认名称空间导入之一的类型显然掩盖了我试图引用的类型. System.Xml
是linqpad中的默认导入之一,但是我很少使用它.是否可以删除默认的名称空间导入,以便我可以使用自己的Formatting
枚举?
I am trying to run a linqpad query, but one of the default namespace imports has a type that is apparently shadowing the type I am trying to reference. System.Xml
is one of the default imports in linqpad, but I rarely use it. Is it possible to remove that default namespace import, so I can use my own Formatting
enum?
推荐答案
这不是您所遇到的直接问题的直接答案,但是您可以告诉LINQPad您想要Formatting
代表哪个.在查询中,按F4
键,然后在其他命名空间导入"选项卡下,可以添加以下内容:
This isn't a direct answer to your immediate question, but you can can tell LINQPad which one you want Formatting
to mean. In your query, press the F4
key and then under the Additional Namespace Imports tab you can add the following:
Formatting = Newtonsoft.Json.Formatting
这告诉LINQPad为您的脚本声明使用别名指令 .请注意,您不应在行前添加using
一词,LINQPad会为您处理剧院.
This tells LINQPad to declare a using alias directive for your script. Note that you should not include the word using
before the line, LINQPad handles theat for you.
这篇关于我可以从linqpad查询中删除命名空间导入吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!