Formatting rule to have blank line between class member declarations
23
Micrsoft provides bunch of coding settings for EditorConfig .NET coding convention settings for EditorConfig
But cannot find the way to create a rule, which will suggest developer to add empty line between class members declaration.
// "Bad" style
public class Order
{
private readonly IRepository _repository;
private readonly IPriceCalculator _priceCalculator;
public Order(IRepository repository, IPriceCalculator priceCalculator)
{
_repostitory = repository;
_priceCalculator = priceCalculator;
}
public CopyFrom(Order originalOrder)
{
// Create new order
}
public Cancel(Customer customer)
{
// Cancel order
}
}
// Good style
public class Order
{
private readonly IRepository _repository;
private readonly IPriceCalculator _priceCalculator;
public Order(IRepository repository, IPriceCalculator priceCalculator)
{
_repostitory = repository;
_priceCalculator = priceCalculator;
}
public CopyFrom(Order originalOrder)
{
// Create new order
}
public Cancel(Customer customer)
{
// Cancel order
}
}