I am creating a program in C#. My problem is that I am unable to find a proper method to check if a variable defined in my program exists or not. For example, if I have created a global variable say "x" and I am calling this variable in some block. According to my code, it should first check it just to make sure if it has been created and if it is created then perform the operations but if it is not then display the message that it is not declared. Logic is proper but the problem is that how can I check if that variable exists in C#? What method should I use for this?
Bookmarks