ReSharper 2026.1 Help

代码检查:不安全上下文声明是多余的。

当不需要时,此检查会报告 unsafe 上下文。 当声明或语句不包含任何不安全代码,或代码已经位于其他不安全上下文中时,就会出现这种情况。

示例

unsafe class C { public int GetValue() => 0; }
class C { public int GetValue() => 0; }

快速修复

快速修复会移除多余的 unsafe 修饰符或代码块。

2026年 5月 8日