Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
358 views
in Technique[技术] by (71.8m points)

winrt xaml - Variable is assigned but its value is never used (C#)

In Visual Studio I used the following code:

 private bool answer = true;
    Private Buttonclick()
   {
      if()
       {
        answer =false
        }
   }

Compiler gives me a warning that says "answer is assigned but its value is never used". How do I fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...