Introduction
I created this article to show developers that are moving to .Net 2.0 that you can now set value type fields to null. This feature was introduced in .Net 2.0.
Here is a list of some of the Value Types in .Net.
Structs |
Enumerations |
Integral types |
Floating-point types |
decimal |
bool |
user defined structs |
Example
<FONT size=2><P></FONT><FONT color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> Main(</FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2>[] args)</P><P>{</P><P></FONT><FONT color=#0000ff size=2> bool</FONT><FONT size=2>? mynullBool = </FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>;</P><P></FONT><FONT color=#0000ff size=2> int</FONT><FONT size=2>? mynullInt = </FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>;</P><P></FONT><FONT color=#008000 size=2> </FONT></P><P><FONT color=#008000 size=2>
Conclusion
The following link points to MSDN for value types. http://msdn2.microsoft.com/en-gb/library/s1ax56ch.aspx
The following link points to MSDN for nullable types. http://msdn2.microsoft.com/en-us/library/1t3y8s4s.aspx
About BuddyWork
Developed Enterprise Applications for various sectors in C, C++, C#, VB, VB.NET, Clipper, Artemis and many more languages.
Currently working in London as a .Net Architect.
Microsoft qualification consists of MCSD.Net and MCPD (Enterprise)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.