>

Articles → .NET → Single Responsibility Principle in C#

Single Responsibility Principle in C#






Purpose





Example




public class Employee {
  public int Id {
    get;
    set;
  }
  public string Name {
    get;
    set;
  }
}

public class EmployeeManagement {
  public void AddEmployee() {}
  public void UpdateEmployee() {}
  public void RemoveEmployee() {}
  public IEnumerable < Employee > GetAllEmployee() {

  }
  public Employee GetEmployeeById(int Id) {

  }
}






public class Employee {
  public int Id {
    get;
    set;
  }
  public string Name {
    get;
    set;
  }
}

public class EmployeeManagement {
  public void AddEmployee() {}
  public void UpdateEmployee() {}
  public void RemoveEmployee() {}
  public IEnumerable < Employee > GetAllEmployee() {

  }
  public Employee GetEmployeeById(int Id) {

  }

  public void ManagePreviousJobDetails() {}
}










public class Employee {
  public int Id {
    get;
    set;
  }
  public string Name {
    get;
    set;
  }
}

public class EmployeeManagement {
  public void AddEmployee() {}
  public void UpdateEmployee() {}
  public void RemoveEmployee() {}
  public IEnumerable < Employee > GetAllEmployee() {

  }
  public Employee GetEmployeeById(int Id) {

  }
}

public class EmployeeJobDetails {
  public void ManagePreviousJobDetails() {}
}



Posted By  -  Karan Gupta
 
Posted On  -  Monday, December 28, 2020

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250