473,396 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Collection Declaration

This may sound like a simple question but in VB.NET you can declare a
Collection as
public MyCollection As Collection

How could you write the same declaration in C#?
Nov 19 '05 #1
2 1021
VB.NET's collection object is unique to VB.
http://msdn.microsoft.com/library/de...lectionpme.asp

The only equivalent is to import the VisualBasic namespace and use it
directly from C#, which some purists might frown upon (but I say go ahead.)

Otherwise you'd probably choose a similar (but slightly different) structure
such as a HashTable or Arraylist, or something else from the Collections
namespace:
http://msdn.microsoft.com/library/de...classtopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


"I am Sam" <Ia****@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com...
This may sound like a simple question but in VB.NET you can declare a
Collection as
public MyCollection As Collection

How could you write the same declaration in C#?

Nov 19 '05 #2
Collection in this sense is a VB.NET specific collection class. VB.NET provides
several helper classes on top of what the .NET runtime provides. I'd sugest
not using these, and instead use the collections that the CLR provides, such
as ArrayList. This way there's less confusion when sharing this collection
with other languages in .NET.

-Brock
DevelopMentor
http://staff.develop.com/ballen
This may sound like a simple question but in VB.NET you can declare a
Collection as
public MyCollection As Collection
How could you write the same declaration in C#?


Nov 19 '05 #3

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

Similar topics

1
by: Mark Dicken | last post by:
Hi All I have found the following Microsoft Technet 'Q' Article :- Q210368 -ACC2000: How to Pass an Array as an Argument to a Procedure (I've also copied and pasted the whole contents into...
2
by: Edward Diener | last post by:
In C++ an overridden virtual function in a derived class must have the exact same signature of the function which is overridden in the base class, except for the return type which may return a...
2
by: wh | last post by:
I have a user control implemented in an .ascx page that I embed in the html as follows: <test:mycontrol runat="server" property1="..." property2="..."/> I'd also like to be able to assign a...
4
by: Michael K. Walter | last post by:
I'd like to create a strongly-typed collection of objects that are indexed by a string value (key is a string). I'd also like to allow users to iterate over the collection using a For-each loop...
0
by: Rene Aichinger | last post by:
Hi, I've created a server control (it inherits from WebControl) wich has a property of genertic collection type. The type of the generic collection is NavigationItem, a little class I've...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
5
by: Nathan Sokalski | last post by:
I was trying to use a code sample from a book I bought (.NET Gotchas by O'Reilly, author = Venkat Subramaniam). The line of code I am trying to use is the following: Dim coll As New...
3
by: jacob navia | last post by:
Abstract: Continuing the discussion about abstract data types, in this discussion group, a string collection data type is presented, patterned after the collection in C# and similar languages...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.