Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using TypeOf in a Select Case
Message
From
11/12/2012 11:01:16
 
 
To
11/12/2012 10:44:58
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01559289
Message ID:
01559311
Views:
49
>>Google says yes
>>
>>
>>   ' Based on the control
>>                            Select Case True
>>                                ' Textbox
>>                                Case TypeOf (locontrol) is System.Web.UI.WebControls.TextBox
>>
>>
>
>Nice trick, I am now wondering if a single evaluation to a string in the Select Case would be as fast as using TypeOf in each Case.


The select case also supports boolean types

As to the speed, you may want to test it.


First case :
String comparison is slow

Second case needs quit a bit of work
- evaluation of the TypeOf operator
- compare with the type ( System.Web.UI.WebControls.TextBox )
- compare the result with the Select Case value ( True)

Think string comparison will be the faster - but -: I do not know
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform