导入语句是不必要的 [英] Import statement is unnecessary

查看:141
本文介绍了导入语句是不必要的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要你的帮助。我将我的项目从VS2013转移到VS2015。但我注意到最后3个导入(System.Math,System.Data,System.IO)是灰色的,并说导入语句是不必要的。会发生什么?我认为这是导致错误的原因。 />


我现在正在使用Vs2015 - VB.net和MS访问



我尝试过:



  Imports  System.Data.OleDb 
Imports System.Math
Imports System.Data
Imports System.IO

解决方案

这是一个Resharper消息,说命名空间不是直接在你的代码中使用。

理论上,这意味着你可以删除Import指令,什么都不会出错。

在实践中我会把它们评论出来为了以防万一。我曾经看到过这个消息出现在System命名空间的时候,但是删除可能导致扩展方法停止工作!



您可以禁用resharper规则:解决方案中的错误/警告 - 帮助| ReSharper [ ^ ]

I need your help. I transfer my project from VS2013 to VS2015. But I notice the last 3 imports (System.Math,System.Data,System.IO) was in color gray and says "Import statement is unnecessary. What happen? I think this one is the reason that will cause an error.

I am using Vs2015 now - VB.net and MS access

What I have tried:

Imports System.Data.OleDb
Imports System.Math
Imports System.Data
Imports System.IO

解决方案

It's a Resharper message, saying that the namespaces aren't directly in use in your code.
In theory, that means that you can just remove the Import directives and nothing will go wrong.
In practice I'd comment them out just in case. I've seen occasions in the past when this message comes up for the System namespace, but removing that can cause Extension methods to stop working!

You can disable resharper rules: Ignoring Errors/Warnings in solution - Help | ReSharper[^]


这篇关于导入语句是不必要的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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