Posts
208
Comments
1144
Trackbacks
51
Nullable Data Readers

I recently submitted an article about Nullable Data Readers .NET 2.0 for review which was posted here:

http://www.codeproject.com/csharp/NullableReaders.asp

As a quick supplemental example for that article, suppose you have a non-nullable type in your business object that you're populating with from a nullable field in the database (this might also happen when populated from an outer join).  This is a good opportunity to use the new nullable coalesce operator (aka, conditional assignmenet) in C# 2.0 like this:

someObject.IsActive = dr.GetNullableBoolean(”IsActive”) ?? false;

posted on Friday, January 20, 2006 5:28 PM Print
Comments
No comments posted yet.

Post Comment

Title *
Name *
Email
Comment *  
Verification

View Steve Michelotti's profile on LinkedIn

profile for Steve Michelotti at Stack Overflow, Q&A for professional and enthusiast programmers




Google My Blog

Tag Cloud