[置顶] .NET中经常用到的函数

   

  •  IsNullOrWhiteSpace

         .NET Framework 4.0  中新增的一个函数,用来判断字符串是否为空(包括空格、NULL、String.Empty、和一行特殊的字符等),与.NET 以前的另一个函数IsNullOrEmpty ()  相比,这个函数的功能更强

    if (!string.IsNullOrWhiteSpace(temp))
          {
                //此处自定义代码
            }
  • File.Exists  Directory.Exists           用于判断文件夹或文件是否存在的函数
            if (File.Exists(filename))
            {
            }

            if (Directory.Exists(dirPath))
            {
            }



 

你可能感兴趣的:(.net,null)