Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ToInt64 returns 0 under Spanish culture
Message
 
 
À
01/11/2017 05:37:53
Information générale
Forum:
C#
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01655310
Message ID:
01655341
Vues:
48
>>UPDATE. Never mind, figured out.
>>
>>Hi everybody,
>>
>>In the immediate window I see the following:
>>
>>tParameters[tcParameterName]
>>"12000007899.456"
>>tParameters[tcParameterName].ToInt64()
>>0
>>
>>Why would ToInt64 return 0 for that value and not the actual value? How can I make it always return the value?
>>
>>Thanks in advance.
>
>Guess you're using an extension method. But IAC you can't convert a 'decimal' string to int so you hiding an exception somewhere. Needs two stages:
>
var i = Convert.ToInt64( Convert.ToDouble("12000007899.456"));
> // i = 12000007899
Right, had to do it through another method and use invariantculture in the first call.
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