ListHelper.cs

Rating: No reviews yet
Downloads: 125
Released: May 31, 2012
Updated: Jun 1, 2012 by CorbyNichols
Dev status: Stable Help Icon

Recommended Download

Source Code ListHelper
source code, 1K, uploaded Jun 1, 2012 - 125 downloads

Release Notes

This is not a new release of RAD Studio Code Generation Toolkit, however I use this file every day and I realized it is not included with the RAD Studio Source Code.

When I wrote the first version of RAD Studio, Generic Lists had just been introduced and I was accustomed to creating Collection Classes for each class.

It is on my to do list to create an option as to what type of collection you return from a FetchAll stored procedure.

I currently have too many things on my plate to upgrade RAD Studio, but this helper class is so useful an upgrade is not urgent.

The ListHelper class contains two very useful methods, and I am pretty sure you will agree with me that this class is so useful you will want to include it in any project that deals with collections or lists.

ConvertToListOf<T>

This method converts any IList to a Generic List of Type <T>;

A typical use of this method is to load a Collection class using a RAD Studio FetchAll method, and then convert the TypedCollection that inherits from CollectionBase, to a System.Collections.Generic list.

HasOneOrMoreItems(IList list)

This method returns true if the List specified exists and hast 1 or more items.

How many time have typed:

if ((collection != null) && (collection.Count > 0))
{
// I wish I had a dollar for every time I had typed this
}

Example:

So here is a short example that uses both of these methods:

// local
EmailReminderCollection tempCollection = null;

// load the tempCollection
tempCollection = this.AppController.ControllerManager.EmailReminderController.FetchAll(tempEmailReminder);

// if there are one or more items in the collection
if (ListHelper.HasOneOrMoreItems(tempCollection))
{
// convert to a List<EmailReminder>
emailReminders = (List<EmailReminder>)
ListHelper.ConvertToListOf<EmailReminder>(tempCollection);
}

For Asp.Net Web Developers

I just released a new set of controls for Visual Studio 2010 Asp.Net developers:

DataJuggler.Web.Controls

http://datajugglercontrols.codeplex.com/

I am not going to duplicate the description here, but there about 10 useful controls that most Asp.Net developers will find useful I think.

As with all of my open source projects if you are not 100% satisfied you get triple your money back!

Open Source is for brilliant developers that suck at marketing!

Reviews for this release

No reviews yet for this release.