一键导入
ide-warnings
.NET IDE code style warning meanings and examples
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
.NET IDE code style warning meanings and examples
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | ide-warnings |
| description | .NET IDE code style warning meanings and examples |
Use this skill when the build reports enabled IDE* diagnostics.
IDE)IDE0001 - Simplify nameWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0002 - Simplify member accessWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
this.member or type qualification is unnecessary for access.IDE0003 - Remove this or Me qualificationWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
this._value where qualification is not required by style.this..IDE0004 - Remove unnecessary castWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
(string)name where name is already string.IDE0005 - Remove unnecessary using directiveWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
using System.Text;.IDE0007 - Use var instead of explicit typeWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
Customer customer = GetCustomer(); where style prefers var.var customer = GetCustomer();.IDE0009 - Add this or Me qualificationWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
_value where style requires this._value.IDE0010 - Add missing cases to switch statementWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0011 - Add bracesWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
if (ready) Run();.IDE0016 - Use throw expressionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
if (x is null) throw ...; return x;.IDE0017 - Use object initializerWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0018 - Inline variable declarationWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
out argument.IDE0019 - Use pattern matchingWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
var c = o as Control; if (c != null).if (o is Control c).IDE0021 - Use expression body for constructorsWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0022 - Use expression body for methodsWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0023 - Use expression body for conversion operatorsWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0024 - Use expression body for operatorsWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0025 - Use expression body for propertiesWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0026 - Use expression body for indexersWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0027 - Use expression body for accessorsWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0028 - Use collection initializerWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
Add repeatedly.IDE0029 - Use coalesce expressionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
x == null ? fallback : x.x ?? fallback.IDE0030 - Use coalesce expression for nullableWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0031 - Use null propagationWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
x == null ? null : x.Name.x?.Name.IDE0032 - Use auto propertyWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0033 - Use explicitly provided tuple nameWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0034 - Simplify default expressionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
default(string).default where target type is clear.IDE0035 - Remove unreachable codeWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0036 - Order modifiersWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
static public.public static.IDE0037 - Use inferred member nameWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0039 - Use local functionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0041 - Use is null checkWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
object.ReferenceEquals(value, null).value is null.IDE0042 - Deconstruct variable declarationWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0045 - Use conditional expression for assignmentWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
if assigns one of two values to the same variable.IDE0046 - Use conditional expression for returnWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
if returns one of two values.IDE0049 - Use language keywords instead of framework type namesWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
System.String.string.IDE0050 - Convert anonymous type to tupleWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0051 - Remove unused private memberWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0052 - Remove unread private memberWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0053 - Use expression body for lambdasWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0054 - Use compound assignmentWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
x = x + 1.x += 1.IDE0056 - Use index operatorWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
items[items.Length - 1].items[^1].IDE0057 - Use range operatorWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
text.Substring(1, text.Length - 2).IDE0058 - Remove unnecessary expression valueWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
Compute(); where the returned value is intentionally ignored but analyzer expects discard.IDE0059 - Remove unnecessary assignmentWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0061 - Use expression body for local functionsWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0063 - Use simple using statementWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
using (...) { ... } where simple using is preferred.using var.IDE0070 - Use System.HashCodeWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
HashCode.Combine.IDE0071 - Simplify interpolationWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
.ToString().IDE0072 - Add missing cases to switch expressionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0074 - Use compound assignmentWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
x = x && y.IDE0075 - Simplify conditional expressionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
condition ? true : false.condition.IDE0080 - Remove unnecessary suppression operatorWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
value! where nullability analysis already proves non-null.!.IDE0082 - Convert typeof to nameofWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
typeof(Customer).Name for a symbol name.nameof(Customer).IDE0090 - Use new expressionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
new Customer() when target type is clear.new() if project style allows.IDE0100 - Remove unnecessary equality operatorWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
== true or == false.IDE0110 - Remove unnecessary discardWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
_ = value; discard is unnecessary.IDE0120 - Simplify LINQ expressionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0130 - Namespace does not match folder structureWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0150 - Prefer null check over type checkWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
x is string ? x != null : false style checks.IDE0160 - Use block-scoped namespaceWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0161 - Use file-scoped namespaceWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0180 - Use tuple swapWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
(a, b) = (b, a).IDE0200 - Remove unnecessary lambda expressionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0210 - Convert to top-level statementsWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0211 - Convert from top-level statementsWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0220 - Add explicit cast in foreach loopWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0230 - Use UTF-8 string literalWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0240 - Nullable directive is unnecessaryWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0241 - Nullable directive is unnecessaryWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0270 - Use coalesce throw expressionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
value ?? throw ... when readable.IDE0290 - Use primary constructorWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0300 - Use collection expression for arrayWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
new int[] { 1, 2 } where collection expression is preferred.[1, 2].IDE0301 - Use collection expression for empty collectionWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
Array.Empty<int>() where collection expression is preferred.[] where target type is clear.IDE0302 - Use collection expression for stackallocWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0303 - Use collection expression for Create methodWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0304 - Use collection expression for builderWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
IDE0305 - Use collection expression for fluent callsWhat it flags: The .NET code-style analyzer found code that differs from the configured style or can be simplified.
Example:
Inspect, unpack, edit, sign, and repack Ren'Py save files. Use when working with Ren'Py .save archives, save metadata JSON, screenshot/extra_info/log/signatures entries, machine save-token keys, or when a user asks to modify or repair a Ren'Py savegame.
correct modelling of C# datastructures for maintainable code
Correctly call native (C/C++) libraries from .NET using P/Invoke and LibraryImport. Covers function signatures, string marshalling, memory lifetime, SafeHandle, and cross-platform patterns. USE FOR: writing new P/Invoke or LibraryImport declarations, reviewing or debugging existing native interop code, wrapping a C or C++ library for use in .NET, diagnosing crashes, memory leaks, or corruption at the managed/native boundary. DO NOT USE FOR: COM interop, C++/CLI mixed-mode assemblies, or pure managed code with no native dependencies.
Guides activity tracing with generated ActivitySources, tags, parent activities, exception status handling, and registration. Use when adding or reviewing OpenTelemetry activity tracing in Bendex flows.
Microsoft code analysis CA warning meanings and examples
Routing guide for enabled compiler and analyzer warnings in this Bendex solution