Generics and Arrays

Posted on: Tue Jul 22 15:43:19 -0700 2008. Updated on: Tue Jul 22 15:46:55 -0700 2008.
Category: DotNet

Quick how to on using generics and arrays:
To declare a new generic list and then do operations with it:

List intsGeneric = new List();
// Add item to list
intsGeneric.Add(234);
// convert to array
int[] intsArray = intsGeneric.ToArray();

Note you can create a generic of any type of object, including your own objects.

Comments:

Add a Comment:

simple_captcha.jpg
(human authentication)


Ads

Categories

About

Random foliage

This website is meant to be a reference for ASP Dot Net developers. The entries are a compilation of things I've figured out how to do and that I deem useful to keep of track for future reference. Assumptions: web development with: C Sharp (vb sucks), visual studio 05/08, .net 3.5, meant for programmers. Written by: James Reategui.