C# 重构

一、Pull Up Field 提取字段

多个类中有相同的字段,可以提取到父类中。

重构前:

   public class Engineer
    {
        public string name { get; set; }
    }

    public class Salesman
    {
        public string name { get; set; }
    }

重构后:

    public class Employee
    {
        public string name { get; set; }
    }


    public class Engineer:Employee
    {
        
    }

    public class Salesman : Employee
    {
         
    }

.......

猜你喜欢

转载自www.cnblogs.com/czly/p/12107169.html