In the very simple example below, the string “foo” is set to null.
string foo = null; foo.ToUpper();
To fix/avoid this error:
- Build null checking into the code and set default values.
- Use Debug.Assert to catch the problem before the exception occurs.
string foo = null; if(foo!=null) {foo.ToUpper();}
No comments:
Post a Comment