csharpier
csharpier copied to clipboard
Consider always putting generic type constraints onto a new line
According to this stylecop rule generic type constraints should always be on a new line.
I think I am on board with modifying this
public static T CreatePipelineResult<T>(
T result,
ResultCode resultCode,
SubCode subCode,
string message = null
) where T : PipeResultBase
{
// vs
public static T CreatePipelineResult<T>(
T result,
ResultCode resultCode,
SubCode subCode,
string message = null
)
where T : PipeResultBase
{
But it makes less sense in cases like this
public int Foo<T>(T obj) where T : U;
// vs
public int Foo<T>(T obj)
where T : U;
From the files in csharpier-repos, only 39% of generic type constraints are on a new line. But that doesn't take into account super short examples vs long ones.