lundi 23 avril 2018

Overloading a method with a difference of list/array of type . Is that a correct approach?

I have a method in businessservice as follows,

public void ProcessModelId(int modelId){
   //method logic for a modelid....
}

Now the requirement is to send list of ids, so should i modify existing method or can i overload another method wit list of ids? like below?

 public void ProcessModelIds(List<int> modelIds){
   foreach(var i in modelIds){//method logic for each modelid....}

    }

which one is correct way in design perspective? or that doesn't matter?

Aucun commentaire:

Enregistrer un commentaire