I am trying to compare strings then have it write hi if the strings are equal.
But whenever I enter AS I get nothing AS being the string i want to compare my input against.
Here is my code.
using System;
namespace testing121
{
class MainClass
{
public static void Main (string[] args)
{
long vrt;
bool run;
string pass = ("AS");
run = true;
string vrt2;
while (run)
{
if (long.TryParse (Console.ReadLine (), out vrt)) {
vrt2 = Convert.ToString (vrt);
if (String.Equals (pass, vrt2) ) {
Console.WriteLine ("Hi");
}
}
}}}}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…