Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CType story
Message
From
26/02/2011 14:40:21
 
 
To
26/02/2011 12:39:56
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01501880
Message ID:
01501948
Views:
40
>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform