Check is user inputs Black, Green or Red. C#
<p>I'm working on a program where I want my user to enter one of the following Colors (Red, Green or Black). But I am stuck.</p><p>What I have done so far is this</p><pre><br /><code>Console.Write("Color To Bet on: ");<br />string tempColor = Console.ReadLine();<br /><br />while (String.IsNullOrWhiteSpace(tempColor))<br />{<br /> Console.Write("The color can't be null.");<br /> tempColor = Console.ReadLine().ToLower();<br />}<br /></code><br /></pre><p>But how can I make sure my users puts in the color I want, I've tried fiddling around with string. Contains method but haven't had any success so far.</p><br /><h2>Click here view more answers <a href="%20http://stackoverflow.com/questions/34525546/check-is-user-inputs-black-green-or-red-c-sharp">http://ift.tt/1VpgoFB</a></h2>
Nhận xét
Đăng nhận xét