可变分配,但从未使用过它的价值 [英] Variable is assigned but its value is never used
本文介绍了可变分配,但从未使用过它的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
喜在Visual Studio是使用下面的代码
Hi in Visual studio is use following code
private bool answer = true;
Private Buttonclick()
{
if()
{
answer =false
}
}
编译器给我警告说:答案被分配但其值从未使用过。
如何清除此。
Compiler gives me warning that "answer is assigned but its value is never used". How to clear this.
推荐答案
这意味着你已经给答案
值,但其他地方没有提及它。这意味着你不能在你的程序中使用的答案别处。
It means you have given answer
a value, but not referenced it elsewhere. Meaning you are not using answer elsewhere in your program.
您从您的程序的其他部分参考答案修复它。
You fix it by referencing answer from another part of your program.
这篇关于可变分配,但从未使用过它的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文