C Programming Tutorials and advice
CProgrammingTrends News Archives About Us Feedback
Sign Up For adCenter - Get $50 In Free* Clicks.

Recent Articles

ECMAScript, The New C++?
Everything but a call for a kitchen sink subroutine has been tossed into ECMAScript 4, leaving a couple of bloggers wondering why. ECMAScript has appeal...

Responses To Microsoft Releasing .NET 3.5 Source
So far the views from Dave, whurley, Matt and others have been negative to handle with caution. After I heard that Microsoft was releasing the .NET 3.5 source...

Resolve & Shorten URLs In C#
Recently I've needed a method that would look at some text and automatically discover all URLs and turn them into hyperlinks. I've done that before so it was a matter of copy/paste. This time it was a little more...

Yahoo SiteExplorer API With C#
If you are interested in using Yahoo's SiteExplorer API and are coding in the ASP.NET environment using C# (web pages) then the following method might be of...

Debug JavaScript In Visual Studio 2005 Like C#
I've been using Visual Studio 2005 for almost 2½ years since the beta 1 release. In all that time, I've used Firefox and Firebug for all JavaScript debugging. I've tried setting breakpoints in JavaScript in Visual...

From VB.NET To C#
Coming from the Visual Basic world, I used to find many examples throughout the web written in VB and VB.NET. Then I got hired by Traceworks which was a VB.NET...

Bind Countries From CultureInfo Class In C#
Some people have asked me how BlogEngine.NET displays a dropdown list of countries when no source XML file is present. The simple answer is that you don't...


12.20.07


IDataRecord Fields To Dictionary Extension Method


By Paul Kinlan

I have never been a fan of directly passing IDataRecords, or IDataReaders for that matter, about the place to get simple field values out.

Therefore, with the introduction of C# 3.0 and Extension Methods, I thought it would be cool to write (and share) a simple implementation of some code that I use to convert the IDataRecord Field data to an Dictionary<string, object> object.



Sign Up For adCenter - Get $50 In Free* Clicks.

It is quite simple really and nothing too complex.

A place where it can be used it Windows Workflow. If you are injecting parameters into your Workflow instance you need to pass a Dictionary in, well now you can (if you desired) simply convert a IDataReader/IDataRecord object into with the following simple piece of code:



This code should be used sparingly, for instance if you wanted a very high performance access to the field data, you might as well stay on the IDataRecord.

Comments


About the Author:
Paul Kinlan is the author of the popular C#, .Net Framework blog. Paul is an Analyst Developer working in Southport, England. Paul has several years experience developing and designing massively scalable enterprise systems on UNIX and Windows based architectures.

About CProgrammingTrends
A collection of articles and tutorials designed to help C and C variant programmers in their programming work. C Programming Tutorials and advice

CProgrammingTrends is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com


-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2007 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


CProgrammingTrends Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact