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 article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here