标签: code-analyst

索引getter中的IndexOutOfRangeException

在我的索引属性中,我检查索引是否超出范围.如果是,我扔了IndexOutOfBoundsException.

当我运行Code Analyst(在VS12中)时,它会抱怨CA1065:意外位置出现意外异常.

仅参考CA1065的描述

System.InvalidOperationException
System.NotSupportedException
System.ArgumentException
KeyNotFoundException
Run Code Online (Sandbox Code Playgroud)

允许在索引的getter中.

投掷IndexOutOfBoundsException对我来说似乎很自然,所以这里的推理是什么?(是的,我知道我可以关闭警告,我只是想知道推理)

.net c# code-analyst

5
推荐指数
2
解决办法
741
查看次数

标签 统计

.net ×1

c# ×1

code-analyst ×1