I am having a value like below :
decimal val = 1.100;
Now what i am trying to do is if i am having 0 after first decimal point value then i
You can use a custom numeric format string:
val.ToString("0.0##")
Hope you like this logic. Please try this.
double val = 1.002;
string output = !val.ToString().TrimEnd('0').Contains('.') ? string.Format("{0}.0", val) : val.ToString().TrimEnd('0');
If the value is 1.00, then my output will be 1.0
Then you can convert this string into other data types.