If Statement condition c# is not working

You were linked the C# syntax above. It is here.

The If statement you wrote in a later post is for a block of code and not a single line expression. Use the ? syntax demonstrated in the link.