|
-
November 27th, 2006, 12:34 PM
#1
.NET Replacement for VB6's 'Array' keyword?
In VB6, it was easy to pass a array of a certain type (ok, technically it was a array of variants) into a function as follows:
Code:
x = Foo(Array(2,3,5,7)) 'Array of integers
I know that in VB.NET, I can accomplish the same thing via code like this:
Code:
Dim bar(4) as Integer
bar(0) = 2
bar(1) = 3
bar(2) = 5
bar(3) = 7
x = Foo(bar)
However, this is a lot of extra code to express the same thing. Is there a way in VB.NET to inline the array definition in a single line (similar to what the VB6 code does)?
Many thanks!
- Kevin
Kevin Hall
-
November 27th, 2006, 12:54 PM
#2
Re: .NET Replacement for VB6's 'Array' keyword?
Code:
x = Foo( New Integer() { 2 , 3 , 5 , 7 } )
-
November 27th, 2006, 02:09 PM
#3
Re: .NET Replacement for VB6's 'Array' keyword?
That was easy! Thanks.
I deal with C++ (ISO, not managed or C++/CLI) 98% of the time and have to dabble with VB.NET every once in a while.
Thanks again!
Kevin Hall
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|