Issue
I have a double? object and want when He has no value to set text on label "0 mm".
I try like this but not work for me:
double? test = weatherBindingData.WeatherDataForecastHourly.List[0].SnowForecast.SnowForecastValue;
if (!test.HasValue)
{
SnowForecast1Day.Text = "0 mm";
}
Solution
double? test = some value or null;
string str = test?.ToString("0.00 mm") ?? "0 mm";
Answered By - MrMoeinM
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.