I have an if control as following ;
if (Directory.Exists(System.IO.Path.Combine(systemPath, "Reports", companyName))
&& Directory.GetFiles(System.IO.Path.Combine(systemPath, "Reports", companyName),
"*.*", SearchOption.TopDirectoryOnly).Length > 0)
First part of control checks whether directory is exists and the second part is for controlling number of the files in directory.
Since the directory may not be exists, the second part it can give an exception of DirectoryNotFoundException. Also I don’t want to make nested if conditions (first if for directory, second if for counting the files)
My question is that;
Does “&&” operator checks the second condition although the first condition is not satisfied ?
No it doesn’t see here