473,473 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Collection initializer in VB 2008

Hello,

Since C# 2008 it is possible to initialize a collection like" this :

var digits = new List<int{0, 1, 2};

Is it also possible in VB 2008, and with what syntax ?

Thank you,
Gilbert
Oct 1 '08 #1
2 2606
Hi Gilbert,

Dim digits = New List(Of Int32)(New Int32() {0, 1, 2})
"Gilbert Tordeur" <gi*************@orange.frwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
Hello,

Since C# 2008 it is possible to initialize a collection like" this :

var digits = new List<int{0, 1, 2};

Is it also possible in VB 2008, and with what syntax ?

Thank you,
Gilbert
Oct 1 '08 #2
There is no 'short-form' for specifying the initial value array (the answer
by Bill is the equivalent, but is not a new 'short-form'). This was
originally planned for VB 2008, but was shelved - I'd guess it will be in the
next version.
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
VB & C# to Java
Java to VB & C#
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++: VB, C#, or Java to C++/CLI
"Gilbert Tordeur" wrote:
Hello,

Since C# 2008 it is possible to initialize a collection like" this :

var digits = new List<int{0, 1, 2};

Is it also possible in VB 2008, and with what syntax ?

Thank you,
Gilbert
Oct 1 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Daniel Billingsley | last post by:
Let's say I'm writing a business app and I want there to be only one instance of the Customer object for each particular customer (representing a database record) being edited. Would it be...
3
by: michael sorens | last post by:
I have seen a few references on the internet on a terse way to initialize a collection, each of which presents a code sample similar to this: List<stringanimals = new List<string{ "monkey",...
3
by: Ham Pastrami | last post by:
class Point { public: const int x, y; Point(int x, int y); } Point::Point(int x, int y) : x(x), y(y) { }
6
by: Marvin Barley | last post by:
I have a class that throws exceptions in new initializer, and a static array of objects of this type. When something is wrong in initialization, CGI program crashes miserably. Debugging shows...
5
by: Pallav singh | last post by:
How can we justify that initializer list is better in performance than assignment list in constructor of C++ ??
11
by: GG | last post by:
Anybody knows of any collection where is not stored in memory but using hard disk instead? Thanks *** Sent via Developersdex http://www.developersdex.com ***
1
by: jnmitts | last post by:
Hi Everyone. Here's the latest collection of software articles from AllPCNews. Enjoy! :) PHP - Web Application Development http://www.allpcnews.com/2008/09/15/php-web-application-development/ ...
1
by: Rene | last post by:
It seems simple enough to use objects initializers to initialize object properties and collection intitializers to initialize collection, what I have not been able to figure out is a way to...
158
by: pushpakulkar | last post by:
Hi all, Is garbage collection possible in C++. It doesn't come as part of language support. Is there any specific reason for the same due to the way the language is designed. Or it is...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.