Static (common in VB.NET) or normal method
I want to know which one is preferable when coding to use static methods or regular instances, I prefer to use static methods if there are few of them, but if there were a lot of them I start to doubt
Example
EmployeeCollection EmpLst = EmployeeManager.GetAllEmployees();
or
EmployeeManager EmpMgr = new EmployeeManager();
EmployeeCollection EmpLst = EmpMgr.GetAllEmployees();
if EmployeeManager has many methods (chooses to delete updates) is it okay to make them static.
and if it was a regular instance. it won't be a disadvantage if the object is instantiated every time on purpose, if GetAllEmployees () is used heavily.
What's the best approach to use?
+2
source to share
3 answers