I am not expecting a definite yes or no. Any knowledge you might have I will consider as an answer.
private String CalculateCharge(Nullable<Decimal> bill, Nullable<Decimal> rate)
{
return ((bill ?? 0.0m) * (rate ?? 0.0m)).ToString("C");
}
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.
Inlining is an implementation detail of the JIT, not of the C# compiler. From Eric Gunnerson’s blog:
Although your method is quite short and not very complex so it might match the heuristics,
Nullable<T>is astructso I’d guess your method is not inlined.As a rule of thumb, if inlining this method improves performance, the JIT will inline this method; otherwise it will not. But this is really an implementation detail of the JIT and nothing you should code for:
EDIT: Apparently the bit about structs not being inlined is out-of-date; updated information can be found at Vance Morrison’s blog.