hi,
suppose in my application i need to perform a lot of
insertions and deletions on my data structure.
the ideal data structure in this scenario would be a linked list.
unlike java, c# does not have a built-in "LinkedList " class.
so which collection class should i use in C#?
regards,
kiran 2 1157
It depends on what type of information you wish to hold in your
collection.
If you have a collection of objects or structs, I would suggest an
ArrayList (System.Collect ions.ArrayList) since you can store objects
within an array list. If you are using .NET Framework 2.0, then use
generics with an ArrayList so you dont have to box/unbox your objects.
If it isnt a collection of objects you could use a HashTable if you
need to store a specific key value (like a Primary Key value for
instance)
Then even further down than that, if you just want to store string
values, you could use a string array.
There is multiple options here, it all depends on how you will be
representing the data in your business logic. I personally try to use
structs/classes as much as possible, because this allows me to not only
store the data, but also additional business rules within the classes
that may pertain to my business logic. It just makes it easier and more
modularized.
For more info look into the System.Collecti ons namespace, as there is
alot more options than what I have mentioned here.
"Kiran A K" <ki*****@trigen t.com> wrote in message
news:Ov******** *****@TK2MSFTNG P09.phx.gbl... hi, suppose in my application i need to perform a lot of insertions and deletions on my data structure. the ideal data structure in this scenario would be a linked list. unlike java, c# does not have a built-in "LinkedList " class. so which collection class should i use in C#?
Without knowing precisely what you are doing and if it is a performance
problem or just a nagging issue, I can't say for sure. Like DKode said
ArrayList or a Hashtable is fine, if you aren't in need of top line
performance. If performance is going to be an issue, LinkedLists are pretty
easy to write, just write one. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Marc L'Ecuyer |
last post by:
Hi,
I have a collection class derived from CollectionBase. This collection can
add items of my class MyItem. In my class MyItem, I have a Selected
property. When this property is set to true, I have to set this property to
false for all other items in the collection (only 1 item can be selected).
How can I do that?
Thanks
|
by: Simon |
last post by:
Hi all,
I'm making an authorisation system that will use a custom class/struct that
I make called Permission
A permission object has an ID, Name and a Description
My question is which collection class would be most appropriate given the
sort of operations that would be required of a permissions collections eg,
- Find based on id,
|
by: Sundown |
last post by:
I am trying to create a custom button control for the web that, when clicked,
disables and changes the text of itself and a bunch of other controls (in the
collection). My goal is to end up with a button that prevents the user from
submitting a form back multiple times and also prevents them from submitting
the form and then clicking something else before the postback can finish
processing.
What I have is a working button that disables...
|
by: Generic Usenet Account |
last post by:
To settle the dispute regarding what happens when an "erase" method is
invoked on an STL container (i.e. whether the element is merely
removed from the container or whether it also gets deleted in the
process), I looked up the STL code. Erase certainly does not delete
the memory associated with the element. However, it appears that the
destructor on the element is invoked. I wonder why it has to be this
way. In my opinion, this renders...
|
by: Kurt Bauer |
last post by:
I have an ASP group calendar application which pulls calendar data from
Exchange via webdav into an XML string. I then loop the XML nodes to
populate a collection of appointments. Finally I use the appointment
collection to populate the calendar control. The performance getting the
XML data is fine, but loading the data into the collection is slow. My
question/problem is should I be using the collection, a dataset, or
something else to...
| |
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 pointer or reference to a derived
type of the base class's return type.
In .NET the overridden virtual function is similar, but an actual parameter
of the function can be a derived reference from the base class's reference
also.
This dichotomy...
|
by: Michael |
last post by:
Dear all ..
If I want to use develop a user control and declare a public property which
the type is System.Windows.Forms.GridTableStylesCollection
For example :
Public Class LookAndView
Inherits System.Windows.Forms.UserControl
Private _Collection As GridTableStylesCollection
|
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 exception of custom
Collection Classes.
Background: I'm developing an A2K .mdb to be deployed as an .mde at my
current job-site. It has several custom controls which utilize custom
classes to wrap built-in controls, and add additional functionality....
|
by: Arthur Dent |
last post by:
How do you sort a generic collection derived from
System.Collections.ObjectModel.Collection?
Thanks in advance,
- Arthur Dent
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |