Guilio
You can also check by using the == operator.
For example:
using System;
class nullcheck
{
private static Foo f;
[STAThread]
static void Main(string[] args)
{
// f = new Foo();
if (f == null)
Console.WriteLine("Foo is not initialized!!!");
else
Console.WriteLine("Foo is initialized.");
return;
}
}
class Foo
{
public int x = -1;
public Foo()
{
x = 5;
}
}
Cheers,
Christian T. [MSFT]
Visual Studio Update Team
- Please do not reply to this email directly. This email is for newsgroup
purposes only.
=========================================================================
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified
at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which
they originated.
=========================================================================
--------------------
Date: Wed, 12 Nov 2003 22:28:51 +0100
From: Giulio Mastrosanti <
[email protected]>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4)
Gecko/20030624 Netscape/7.1 (ax)