If Statement condition c# is not working

You’re using vb.net syntax. C# syntax is different: