Solved

Generic Classes question

Posted on 2007-04-07
1
200 Views
Last Modified: 2013-11-07
Hi experts,
I wanted to build a sorted list structure something like the generic SortedList class in C# but I am not able to change the value of an element after Add()ing it (since it is readonly property). I need to read the value, sum it and write back, as I do not know its final value when I Add() it to the structure.
Is there a way to over come this limitation?
0
Comment
Question by:novknow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
Yttribium earned 500 total points
ID: 18872131
How are you using the sorted list, do you have an example?

When I did:

SortedList SL = new SortedList();
SL.Add("Obj1", 1);      
SL.Add("Obj2", 2);
SL.Add("Obj3", 3);
SL.Add("Obj4", 4);
SL["Obj1"] = 2;
MessageBox.Show(SL["Obj1"].ToString());

I didn't get a problem, probably I misunderstand your usage.
0

Featured Post

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question