Link to home
Start Free TrialLog in
Avatar of altlogic
altlogic

asked on

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

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

Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

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.
Avatar of altlogic
altlogic

ASKER

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)
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Have opted for the Collection and I am using CType to use type checking. Many thanks for all your help.