gpt4 book ai didi

c# - 如何将一些 using 语句设置为不冗余,即使它们是冗余的?

转载 作者:行者123 更新时间:2023-11-30 14:08:39 25 4
gpt4 key购买 nike

创建的文件通常以一组通用的 using 语句开头。有时即使充实了类(class),我也不需要一些自动生成的 using 语句。但是,如果最终需要它们,则删除它们可能会导致问题,例如删除 using System.Linq 导致的问题;有没有办法告诉 Visual Studio/Resharper 不要提示某些 using 语句是多余的?

例子:

using System;
using System.Collections.Generic; // Don't need but want anyway without an error
using System.Linq; // Don't need but want anyway without an error
using System.Net;
using System.Text; // Don't need but want anyway without an error
using Acceptance.EndToEnd.Helpers;
using Acceptance.EndToEnd.Locators;

最佳答案

ReSharper 提供了一种更好的方法来执行此操作:

enter image description here

关于c# - 如何将一些 using 语句设置为不冗余,即使它们是冗余的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34228990/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com