Try Parse
what difference between following 2 code snippets,
int32.try parse fails 1st sample, decimal.try parse succeeds both samples giving output of -50. bit confused why value of 50- (i.e. minus sign -) after 50 okay decimal not int32? extracting value excel sheet , doing conversion.
string value = "50-"; decimal v = 0; decimal.tryparse(value, out v); vs string value = "-50"; decimal v = 0; decimal.tryparse(value, out v);
regards, vinay
hi vinay,
string value = "50-"; decimal v; numberstyles styles = numberstyles.allowdecimalpoint | numberstyles.allowtrailingwhite | numberstyles.allowleadingsign | numberstyles.allowthousands; decimal.tryparse(value, styles , cultureinfo.currentculture, out v);
aelassas.free.fr
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment