Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
注释左对齐“;ReSharper disable PossibleNullReferenceException“;打破了编码风格_Resharper - Fatal编程技术网

注释左对齐“;ReSharper disable PossibleNullReferenceException“;打破了编码风格

注释左对齐“;ReSharper disable PossibleNullReferenceException“;打破了编码风格,resharper,Resharper,每当出现可能的空引用异常时,Resharper建议使用以下注释检查、断言或抑制警告: // ReSharper disable PossibleNullReferenceException objectWhichCouldBeNull.DoSomething(); // ReSharper restore PossibleNullReferenceException 但是,注释总是缩进到源代码文档的左边缘。有没有办法使注释与其他代码保持一致,特别是在使用Resharpe

每当出现可能的空引用异常时,Resharper建议使用以下注释检查、断言或抑制警告:

// ReSharper disable PossibleNullReferenceException
            objectWhichCouldBeNull.DoSomething();
// ReSharper restore PossibleNullReferenceException
但是,注释总是缩进到源代码文档的左边缘。有没有办法使注释与其他代码保持一致,特别是在使用Resharper代码清理功能(Ctrl-Alt-F)时

以下是它应该是什么样子:

            // ReSharper disable PossibleNullReferenceException
            objectWhichCouldBeNull.DoSomething();
            // ReSharper restore PossibleNullReferenceException

尝试禁用
ReSharper |选项|代码编辑| C#|格式样式|其他|其他|不要缩进从第一列开始的注释

抱歉。只是尝试了一下,但没用。Visual Studio 2015和ReSharper 10.0.1。