If varible is string, then to check if it is null use:

if (containerid.IsNullOrEmpty())
{  containerid = "-1"; }

Or String.IsNullOrEmpty()

Because null is not empty...

In VS.NET go to the project property page and in configuration properties>build set Allow Unsafe Code Blocks to True.


Taken from here.