[Mono-list] FieldInfo.GetValue trouble with null

Ben Maurer bmaurer@users.sourceforge.net
Sun, 04 Apr 2004 16:16:01 -0400

For valuetypes, the `null' value is 0, false, or whatever (basically,
what happens if each integer is set to 0 and each reference to null).

-- Ben

On Sun, 2004-04-04 at 14:42, Philip wrote:
> Question regarding the use of the FieldInfo object.
> I'm using the FieldInfo object, calling the GetValue(object) method. The
> object that I'm passing to the method is only partially populated, so
> some of the fields are uninitialized (null). However when the
> FieldInfo.GetValue(object) returns the value, uninitialized integers
> (which I had hoped would still be null) are returned as 0 and
> uninitialized bools (which should be null also) are returned as false,
> null strings however are returned properly. Has anyone else run into a
> similar problem? Should I not be expecting FieldInfo.GetValue to return
> uninitialized ints and bools as null? Any help would be great.
> - Phil
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list