I want to round a double? value so that if its value is 2.3 the result should be 2 but if the input is null then the result should be null.
I want to round a double? value so that if its value is 2.3
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no direct way to round a nullable double. You need to check if the variable has a value: if yes, round it; otherwise, return
null.You need to cast a bit if you do this using the conditional
?:operator:Alternatively: