|
Sponsored Links
Resources
.NET Research Library
Get .NET related white papers, case studies and webcasts
|
News
News
News
|
Messages: 9
Messages: 9
Messages: 9
Printer friendly
Printer friendly
Printer friendly
Post reply
Post reply
Post reply
XML
XML
XML
|
 |
Microsoft Adds New Support for Nullable Types in .NET 2.0
Microsoft has added a last minute change to the implementation of Nullable types in .NET 2.0. This change allows for simpler null checks when using boxed references and generics. This new feature also provides the ability to coerce a nullable type to an interface implemented by the enclosed type.
The outcome is that the Nullable type is now a new basic runtime intrinsic. It is still declared as a generic value-type, yet the runtime treats it special. One of the foremost changes is that boxing now honors the null state. A Nullabe int now boxes to become not a boxed Nullable int but a boxed int (or a null reference as the null state may indicate.) Likewise, it is now possible to unbox any kind of boxed value-type into its Nullable type equivalent. Read more at Somasegar's Weblog
|
|
Message #182205
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
big fat mistake
I can't help but feel this feature is ripe for abuse and unmaintainable code. When some other programmer has to fix or patch the code, how long is it going to take to figure out what it means. I really wish Microsoft would push for better coding and development practices and less on questionable features. Having spent lots of time fixing really aweful code, I can see the rampant abuse now.
I'm sure plenty of people will disagree.
peter
|
|
Message #182224
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Is there a difference?
I've looked at the syntax in the blog post but I am failing to see any change at all in the syntax, either that or I need to go back and re-read it. Was the change just in the hidden boxing/unboxing stuff?
|
|
Message #182259
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
It's only in the Runtime...
<Quote> Once an instance of the type was boxed (by casting to the base ‘Object’ type), it became a boxed value type, and no matter what its original ‘null’ state claimed, the boxed value-type was never null. </Quote>
They tweaked the runtime behaviour of the generic Nullable struct, so that when the HasValue field is false and you assign it to a variable ot type object, this variable will be null, which is good, instead of being a boxed instance of that nullable type which is null...
Therefore I think this change is very nice and intuitive. Big up for the guys fixing this...
|
|
Message #182301
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
It's only in the Runtime...
I agree, big up, didn't know the issue existed however. Anyway, it works now how it should ...
|
|
Message #182328
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
It's only in the Runtime...
<Quote>Once an instance of the type was boxed (by casting to the base ‘Object’ type), it became a boxed value type, and no matter what its original ‘null’ state claimed, the boxed value-type was never null.</Quote>They tweaked the runtime behaviour of the generic Nullable struct, so that when the HasValue field is false and you assign it to a variable ot type object, this variable will be null, which is good, instead of being a boxed instance of that nullable type which is null...Therefore I think this change is very nice and intuitive.Big up for the guys fixing this... ok.. that makes much more sense. I retract my statement about it being a big mistake. though the blog and article both did a horrible job explaining it. not that I haven't horrible articles myself, but it would be better to have a clearer explanation.
peter
|
|
Message #182426
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Microsoft Adds New Support for Nullable Types in .NET 2.0
Why is the fuss with this very basic feature? Man, I can hardly believe the happiness and ectasis people is now feeling about being able to have a "Nullable Object"
As for myself... I'll stick to using the NullableObjects framework from SourceForge. It has solved my problems for more than 1.5 years by now.
Good luck!
|
|
 |
Hot threads
Hot threads
Hot threads
|
More hot threads
More hot threads
More hot threads
|
 |
Speaking at EclipseCon 2006, Java developer and independent consultant Madhu Siddalingaiah compared Microsoft's Visual Studio IDE to the open source development environment of Eclipse.
(33 comments,
last posted
July 13, 2009)
In this tech talk, Microsoft's Peter Provost talks about the design of the Composite UI Application Block and how the p&p team has led Microsoft in the adoption of Agile methodologies.
(0 comments,
last posted
April 17, 2006)
Chapter 4 of Framework Design Guidelines, titled "Type Design Guidelines," presents patterns that describe when and how to design classes, constructs and interfaces. In this chapter, Abrams and Cwalina divide types into four groups and discuss the do's and don'ts of type design.
(2 comments,
last posted
July 07, 2006)
Paul Ferrill caught up with prime open-source .NET applications driver Miguel De Icaza at Novell's BrainShare conference last week. They discussed the status of Windows Forms for Mono (it's coming along) and VB.NET for Mono (it looks like it's out).
(5 comments,
last posted
March 30, 2006)
In this tech talk, Microsoft Visual Studio architect Jack Greenfield discusses the company's approach to Domain-Specific Languages, or DSLs, and the part they play in software factories.
(0 comments,
last posted
March 15, 2006)
More hot threads »
|
|