Discussion:
More integer magic.
Brady Kelly
2008-02-26 09:55:18 UTC
Permalink
Using PropertyInfo.SetValue(), one can attempt to assign null to an integer
without an exception. The integer is assigned a value of zero.


===================================
This list is hosted by DevelopMentor� http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Per Bolmstedt
2008-02-26 10:01:55 UTC
Permalink
Post by Brady Kelly
Using PropertyInfo.SetValue(), one can attempt to assign null to an
integer without an exception. The integer is assigned a value of
zero.
I don't think this has anything to do with integers. I'm guessing SetValue()
simply assigns default(T) if the assigned value is invalid.

===================================
This list is hosted by DevelopMentor® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Brady Kelly
2008-02-26 13:21:26 UTC
Permalink
Post by Per Bolmstedt
I don't think this has anything to do with integers. I'm guessing SetValue()
simply assigns default(T) if the assigned value is invalid.
I would prefer it attempted to cast and assign the invalid value, causing a
NullReference exception or some or other exception, so I know there is a
problem.

===================================
This list is hosted by DevelopMentor� http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Per Bolmstedt
2008-02-26 13:26:27 UTC
Permalink
Post by Brady Kelly
Post by Per Bolmstedt
I don't think this has anything to do with integers. I'm guessing
SetValue() simply assigns default(T) if the assigned value is invalid.
I would prefer it attempted to cast and assign the invalid value,
causing a NullReference exception or some or other exception,
From a really quick glance at the documentation (try it, you'll like it) I
think you need to supply a non-default Binder to the SetValue operation for
that, since the default binder obviously fails silently.

===================================
This list is hosted by DevelopMentor® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Brady Kelly
2008-02-26 13:45:08 UTC
Permalink
Post by Brady Kelly
From a really quick glance at the documentation (try it, you'll like
it)
I love it, I just hate Document Explorer ;-)

===================================
This list is hosted by DevelopMentor� http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Per Bolmstedt
2008-02-26 14:31:18 UTC
Permalink
Post by Brady Kelly
Post by Brady Kelly
From a really quick glance at the documentation (try it, you'll like
it)
I love it, I just hate Document Explorer ;-)
The built-in help viewer in Visual Studio? I haven't used that in a long
time. I always search for keywords online using Google, along the lines of
"binder site:msdn2.microsoft.com -inurl:vs(" (in your case). It's faster and
much more predictable. Just setup a search keyword (or the non-Firefox
equivalent) in the browser and any search is just a few keypresses away.

===================================
This list is hosted by DevelopMentor® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Brady Kelly
2008-02-26 14:55:38 UTC
Permalink
Post by Per Bolmstedt
The built-in help viewer in Visual Studio? I haven't used that in a long
time. I always search for keywords online using Google, along the lines of
"binder site:msdn2.microsoft.com -inurl:vs(" (in your case). It's faster and
much more predictable. Just setup a search keyword (or the non-Firefox
equivalent) in the browser and any search is just a few keypresses away.
Thanks, I'll have a look at that. I normally just use straight Google, i.e.
"binder", but have to sift through some noise.

===================================
This list is hosted by DevelopMentor� http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Loading...