Solved

List (of T) Works in VS2005 but not in VS2003

Posted on 2009-07-13
5
617 Views
Last Modified: 2013-11-17
I have an application that runs on Compact Framework (VB.NET) developed under visual studio 2005 (CF2). I have a requirement to recompile this code using visual studio 2003 (CF1.1)  however the List (of T) (from  System.Collections.Generic List(T) Class) command is not supported. Is there an equivalent syntax/command I can use for an array of objects. (The code that fails is enclosed : Public items As List(Of Item)) - Many thanks.
Public Class item

    Public uid As String

    Public suspend As String

    Public success As String

    Public msg_text As String

    Public msg_result As String
 

    Public result_selcted As Boolean
 

    Public Sub New()

        uid = ""

        suspend = ""

        success = ""

        msg_text = ""

        msg_result = ""

    End Sub

End Class
 

Public Class question

    Public dbref As String

    Public uid As String

    Public type As String

    Public suspend As String

    Public success As String

    Public items As List(Of Item)
 

    Public Sub New()

        dbref = ""

        uid = ""

        type = ""

        suspend = ""

        success = ""

        items = New List(Of item)

    End Sub

End Class

Open in new window

0
Comment
Question by:altlogic
  • 2
  • 2
5 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 24841966
this feature is called Generics and was new in VS2005.

you will need to remove the (of T) but you will loose all type checking at the same time.
0
 

Author Comment

by:altlogic
ID: 24842106
Many thanks for help so far - List on it's own does not appear to be supported either.... (Type 'List' is not defined') I can define it as an array but would I still be able to store an object in it? (Part of the application havily depends on being able to address each object / properties)
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 24842269
In VB.Net 2003 (and below) an ArrayList would suffice:
http://msdn.microsoft.com/en-us/library/system.collections.arraylist(VS.71).aspx
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 24842272
you could use a Array or a Collection (it would be better since less modification would be required)
0
 

Author Comment

by:altlogic
ID: 24843818
Have opted for the Collection and I am using CType to use type checking. Many thanks for all your help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now