Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CType story
Message
De
26/02/2011 14:40:21
 
 
À
26/02/2011 12:39:56
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01501880
Message ID:
01501948
Vues:
41
>>You can do it (but it is A REALLY BAD IDEA) eg:
Public Class Class1
>>    Public [Ctype] As String = "Hello"
>>End Class
Then:
Dim c1 As Class1 = New Class1
>>Dim theLength As Integer = c1.Ctype.Length
>
>Actually, this works:
>
>
>    Public Class LabelFunction
>
>        Public [cType] As String = ""
>
>        ' Initialize
>        Public Function Initialize() As Boolean
>
>            ' Based on the language
>            Select Case nLanguage
>
>                ' English
>                Case 1
>                    [cType] = "Type"
>
>
>
>Then, from the application, I can do:
>
>
>Dim lcField As String = ""
>lcField = "Something," + oProcess.oLabel.cType
>
>
>Is there any problem doing it like that? Basically, it allows me to use oProcess.oLabel.cType, for its real representation instead of usingn oProcess.oLabel.cType2.

You are basically defining a name 'CType' within your own namespace. There is no problem insomuch as the code is perfectly safe. However it is generally regarded as bad practice since the use of what appears to be a reserved word can be confusing to other programmers.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform