Looking at System.Threading.Tasks.Dataflow (amazing library by the way), I see three different variations of formatting of single-statement if statements. In one method.
From DataflowBlock.OutputAvailableAsync
One line:
if (source == null) throw new ArgumentNullException("source");
Two lines:
if (cancellationToken.IsCancellationRequested)
return Common.CreateTaskFromCancellation<bool>(cancellationToken);
With braces:
if (target.Task.IsCompleted)
{
return target.Task;
}
Are the guidelines for formatting these more nuanced than I'm able to see, or is this just inconsistent formatting? Is this kind of inconsistent formatting normal and acceptable? Is there a preference for how new code should be formatted?
Looking at
System.Threading.Tasks.Dataflow(amazing library by the way), I see three different variations of formatting of single-statementifstatements. In one method.From
DataflowBlock.OutputAvailableAsyncOne line:
Two lines:
With braces:
Are the guidelines for formatting these more nuanced than I'm able to see, or is this just inconsistent formatting? Is this kind of inconsistent formatting normal and acceptable? Is there a preference for how new code should be formatted?