Steve Michelotti

C#, ASP.NET, and other stuff

  Home  |   Contact  |   Syndication    |   Login
  45 Posts | 1 Stories | 133 Comments | 52 Trackbacks

News



Archives

Post Categories

Image Galleries

Articles

Blogs

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