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);  
kind regards,


aelassas.free.fr


Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'