
NullReferenceException is a C# version of NullPointerException. To handle and catch it in C#, use try-catch.
The below example shows that a variable is set to null and when we try to print it, it throws an exception that gets caught in the catch −
程序介绍:程序采用.net 2.0进行开发,全自动应用淘客api,自动采集信息,无需,手工更新,源码完全开放。(程序改进 无需填入阿里妈妈淘客API 您只要修改app_code文件下的config.cs文件中的id为你的淘客id即可)针对淘客3/300毫秒的查询限制,系统采用相应的解决方案,可以解决大部分因此限制带来的问题;程序采用全局异常,避免偶尔没考虑到的异常带来的问题;程序源码全部开放,请使
Try {
a = null;
Console.WriteLine(a);
}catch (NullPointerException ex) {
Console.WriteLine("Variable is Null!");
}上述代码将允许捕获异常并使用catch处理它。









