'引用use unreached /从不在带有枚举的switch语句中执行此数组创建' [英] 'Reference use unreached/This array creation is never executed' on switch statement with enum

查看:78
本文介绍了'引用use unreached /从不在带有枚举的switch语句中执行此数组创建'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,另一个不可重现的(代码在升级前编译正常)。
Sorry, another non reproducible (code was compiling fine before upgrade).

推荐答案

是的,你现在收到此警告,因为现在静态检查器正在跟踪枚举值,在特定情况下,它会发现您的开关是耗尽的,因此默认情况下永远不会执行。

yep, you are now getting this warning because now the static checker is tracking the values of enums, and in the particular case it finds that your switch is exhastive, so the default is never executed.

另一种关闭检查器的方法是添加SuppressMessage注释。

Another way to shut the checker off is to add a SuppressMessage annotation.

ciao,

f


这篇关于'引用use unreached /从不在带有枚举的switch语句中执行此数组创建'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆