Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
EVL analogue in C#
Message
 
 
À
09/07/2013 16:17:14
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01578022
Message ID:
01578025
Vues:
50
>>Hi everybody,
>>
>>Quite often I am getting an exception about Invalid format. Say, I just got one here
>>
>>
>>Byte instr_type = Convert.ToByte(GetParameterValue(rowValues, "instr_type"));
>>
>>The value is returned as empty string and apparently ToByte and other conversions can not deal with empty string. So, EVL function may be helpful here.
>>
>>Is there any way to write this expression to not get exception without doing this with extra variable first?
>>
>>Thanks in advance.
>
>Would Byte.TryParse work for you?

Yes, essentially this is what I used. We had methods already to return parameter value in needed format, but we didn't have GetParameterByte method. So, I went ahead and added it with TryParse.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform