Is it better to create methods with a long list of parameters or wrap the parameters into an object?

Posted by GigaPr on Stack Overflow See other posts from Stack Overflow or by GigaPr
Published on 2010-04-08T09:18:16Z Indexed on 2010/04/08 9:23 UTC
Read the original article Hit count: 163

Filed under:

Hi,

Is it better(what is the best practice) to create methods with a long list of parameters or wrap the parameters into an object?

I mean lets say i have a Client data type with a long list of properties and i want to update all the properties at once. is it better to do something like

public int Update(int id, string name, string surname, string streetAddress, string streetAddress2, string postcode, string town, string city, string nationality, string age, string gender,string job){

}

or wrap all the properties in a object and do something like

public int Update(Client client){}

thanks

© Stack Overflow or respective owner

Related posts about c#