7
shouts

C# And Accepting Parameters « Yet Another WebDev Blog

published 217 days, 13 hours, 20 minutes ago posted by http://hboss.myopenid.com/http://hboss.myopenid.com/ 218 days, 14 hours, 31 minutes ago
Tuesday, July 07, 2009 12:58:38 PM GMT Monday, July 06, 2009 11:48:03 AM GMT

Have you ever written a function that looked similar to the following – Passing in an array of a value?

public void UpdateList(string[] list) { //...etc... }

It’s not that uncommon of a method, but did you know you can take it a little further? The params Keyword The params keyword is an interesting modifier to an argument for a method. It allows a user to pass individual values instead of using the array itself.

public void ProcessList(params string[] args) { //...etc... }

//old way still ...

category: ASP.NET | clicked: 48 | | source: somewebguy.wordpress.com | show counter code
tags: C#, Params, Programming