Micrsoft 为 EditorConfig 提供了一堆编码设置 .NET 为 EditorConfig 编码约定设置
但是找不到创建规则的方法,这将建议开发人员在类成员声明之间添加空行。
// "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
}
}