I am new to C#
and I'm trying to write a contains statement. I want the process to read the test
variable and if it contains the word error then print the variable if it does not contain an error then print no error. I think my process is close except when I run the code below I get an error when the CLI runs.
"object reference not set to an instance of an object"
Any help would be appreciated!
while (true)
{
test = queue.GetMessage();
if (test.AsString.Contains("error"))
{
Console.WriteLine(string.Format("Variable: {0}", test.AsString));
}
else
Console.WriteLine(string.Format("No Error: {0}", test.AsString));
}