What will happen if we compile below C# code? Whether it will compile or not.If compile then what will be the output?

if (string.IsNullOrEmpty(false))

if (string.IsNullOrEmpty(1))

 Posted by vishalneeraj-24503 on 7/1/2014 | Category: C# Interview questions | Views: 653 | Points: 40

It will not give us any output because it will throw compile-time error as:-

The best overloaded method match for 'string.IsNullOrEmpty(string)' has some invalid arguments
Argument 1: cannot convert from 'bool' to 'string'
Argument 2: cannot convert from 'int' to 'string'

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response