Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 6th, 2009, 04:45 PM
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 75
Thanks: 15
Thanked 0 Times in 0 Posts
Default Dim list As New List(Of Testclass)

Dim list As New List(Of Testclass)

I was wondering if someone can tell me what the above line of code means or what is the concept behind this code?

Thanks In Advance
 
Old January 6th, 2009, 08:19 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

The base concept behind this is Generics.
This is where the Type of object is provided to the class as a paramter, ie Testclass.
In this instance you are creating a generic "List" of the class Testclass.

The generic List class holds all the methods and properties that are required to contain a list of any object. You provide the type of object that the list will hold when you create the generic list.

So once you have instanciated your list you can then add objects to it, of the type you provided as a parameter, remove them, count them, etc.

Generics are a very powerful concept and you should do some reading on generics as well as the specific generic List(T) class.

All the best.
__________________
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
The Following User Says Thank You to rodmcleay For This Useful Post:
dotnetDeveloper (January 7th, 2009)




Similar Threads
Thread Thread Starter Forum Replies Last Post
Dim list As New List(Of Testclass) dotnetDeveloper Visual Basic 2008 Essentials 0 January 6th, 2009 04:04 PM
multi-column list box values moved to 2nd list box sbmvr Access VBA 1 May 14th, 2007 01:58 PM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
List tablesname from database & list databasename ittorget MySQL 3 September 10th, 2005 03:06 AM
creat a list and sub list helmekki Excel VBA 0 May 23rd, 2004 02:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.