O ORC Oct 30, 2004 #1 When initializing a IntPtr can I then be sure that this initializes to a zero pointer: ? "IntPtr MyPointer = new IntPtr();" Thanks Ole
When initializing a IntPtr can I then be sure that this initializes to a zero pointer: ? "IntPtr MyPointer = new IntPtr();" Thanks Ole
S Scott Allen Oct 30, 2004 #2 Yes, the default ctor will initialize the IntPtr to zero. There is also: IntPtr foo = IntPtr.Zero;
R Richard Blewett [DevelopMentor] Oct 30, 2004 #3 That would definitely give a zero IntPtr as its a value type. However, its probably clearer in the code to use IntPtr.Zero Regards Richard Blewett - DevelopMentor http://staff.develop.com/richardb/weblog When initializing a IntPtr can I then be sure that this initializes to a zero pointer: ? "IntPtr MyPointer = new IntPtr();" Thanks Ole
That would definitely give a zero IntPtr as its a value type. However, its probably clearer in the code to use IntPtr.Zero Regards Richard Blewett - DevelopMentor http://staff.develop.com/richardb/weblog When initializing a IntPtr can I then be sure that this initializes to a zero pointer: ? "IntPtr MyPointer = new IntPtr();" Thanks Ole