Hi @SimonCropp thanks for all your contributions in a row!
For this one though, I'm not that positive, let me explain.
I use that same pattern a lot, for both mca (MemoryCacheAccessor), dca (DistributedCacheAccessor) and bpa (BackplaneAccessor), and I like that the same code pattern is used for all of them and all is uniform.
And I cannot use ?. because it cannot be used with multiple lines, and the alternative is that I would have to repeat ?. for every line.
For example with dca I commonly have multi-lines code, like this:
if (dca is not null)
{
var dcaSuccess = false;
try
{
if (dca.IsCurrentlyUsable(operationId, key))
{
dcaSuccess = await distributedCacheAction(dca, isBackground, ct1).ConfigureAwait(false);
}
// ...
Same thing for bpa:
if (bpa is not null)
{
var bpaSuccess = false;
try
{
if (bpa.IsCurrentlyUsable(operationId, key))
{
bpaSuccess = await backplaneAction(bpa, isBackplaneBackground, ct2).ConfigureAwait(false);
}
}
// ...
So I think I prefer to keep the codebase as uniform as possible.
Also in this case there are no perf gains, since the lowered code is identical.
Hi @SimonCropp thanks for all your contributions in a row!
For this one though, I'm not that positive, let me explain.
I use that same pattern a lot, for both
mca
(MemoryCacheAccessor
),dca
(DistributedCacheAccessor
) andbpa
(BackplaneAccessor
), and I like that the same code pattern is used for all of them and all is uniform.And I cannot use
?.
because it cannot be used with multiple lines, and the alternative is that I would have to repeat?.
for every line.For example with
dca
I commonly have multi-lines code, like this:Same thing for
bpa
:So I think I prefer to keep the codebase as uniform as possible.
Also in this case there are no perf gains, since the lowered code is identical.
But I'm open to a discussion, what do you think?