Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB.NET
Expertise: Intermediate
Nov 24, 2001

Use a ParamArray as a true array

Unlike VB6, in VB.NET the ParamArray keyword defines a true array object, which you can process using any of the methods of the Array class. For example, here' s a function that evaluates the lowest value among those passed to the procedure, using the static Array.Sort method and then taking the element with the lowest index:

Function MinValue(ParamArray ByVal args() As Object) As Object
    ' Sort the array, and then return its 1st element.
    System.Array.Sort(args)
    Return args(0)
End Function
Also, note that the ParamArray keyword lets you define arrays of any type, not just objects.
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date