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");
}
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");
}
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 astruct
so 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.