Click here to Skip to main content
15,890,557 members
Home / Discussions / C#
   

C#

 
QuestionRe: can someone help me... Pin
nelsonpaixao17-Nov-08 13:32
nelsonpaixao17-Nov-08 13:32 
QuestionData Structure Pin
duta16-Nov-08 7:23
duta16-Nov-08 7:23 
AnswerRe: Data Structure Pin
sph3rex16-Nov-08 8:31
sph3rex16-Nov-08 8:31 
AnswerRe: Data Structure Pin
User 665816-Nov-08 8:44
User 665816-Nov-08 8:44 
AnswerRe: Data Structure Pin
Mark Churchill16-Nov-08 12:49
Mark Churchill16-Nov-08 12:49 
GeneralRe: Data Structure Pin
Alan Balkany17-Nov-08 4:03
Alan Balkany17-Nov-08 4:03 
GeneralRe: Data Structure Pin
Mark Churchill17-Nov-08 11:42
Mark Churchill17-Nov-08 11:42 
AnswerRe: Data Structure Pin
Guffa16-Nov-08 13:05
Guffa16-Nov-08 13:05 
duta wrote:
I'm very new to C# but I have some experience in C++. There a struct array was an alternative but I don't know how to do that in C#.


A struct in C++ is a different thing from a struct in C#. In C++ a struct is a definition for either an object or a value type, but in C# a struct is always a value type.

To efficiently search the data, you should use a data structure like Dictionary<string, List<int>>.

Something like:

// create dictionary
Dictionary<string, List<int>> items = new Dictionary<string, List<int>>();
// populate it with data from the file
foreach (string line in File.ReadAllLines(pathName)) {
   string[] data = line.Split('\t');
   List<int> list;
   if (!items.TryGetValue(data[0], out list) {
      list = new List<int>();
      items.Add(data[0], list);
   }
   list.Add(int.Parse(data[2]));
}
// get the list for a specific string
List<int> aaabb = items["aaabb"];
// sort the list
aaabb.Sort();


Despite everything, the person most likely to be fooling you next is yourself.

AnswerRe: Data Structure Pin
Mycroft Holmes16-Nov-08 15:15
professionalMycroft Holmes16-Nov-08 15:15 
QuestionCasting Error Pin
Vimalsoft(Pty) Ltd16-Nov-08 4:02
professionalVimalsoft(Pty) Ltd16-Nov-08 4:02 
AnswerRe: Casting Error Pin
Wendelius16-Nov-08 4:38
mentorWendelius16-Nov-08 4:38 
GeneralRe: Casting Error Pin
Guffa16-Nov-08 6:58
Guffa16-Nov-08 6:58 
GeneralRe: Casting Error Pin
Wendelius16-Nov-08 9:44
mentorWendelius16-Nov-08 9:44 
AnswerRe: Casting Error Pin
Guffa16-Nov-08 7:01
Guffa16-Nov-08 7:01 
GeneralRe: Casting Error Pin
Vimalsoft(Pty) Ltd16-Nov-08 9:25
professionalVimalsoft(Pty) Ltd16-Nov-08 9:25 
GeneralRe: Casting Error Pin
Guffa16-Nov-08 13:10
Guffa16-Nov-08 13:10 
Answer[Resolved]Re: Casting Error Pin
Vimalsoft(Pty) Ltd16-Nov-08 19:29
professionalVimalsoft(Pty) Ltd16-Nov-08 19:29 
QuestionSolution for Tower of Hanoi with Breadth First Search Algorithm ? Pin
Mohammad Dayyan16-Nov-08 2:34
Mohammad Dayyan16-Nov-08 2:34 
AnswerRe: Solution for Tower of Hanoi with Breadth First Search Algorithm ? PinPopular
#realJSOP16-Nov-08 3:01
mve#realJSOP16-Nov-08 3:01 
GeneralRe: Solution for Tower of Hanoi with Breadth First Search Algorithm ? Pin
Mohammad Dayyan16-Nov-08 16:16
Mohammad Dayyan16-Nov-08 16:16 
AnswerRe: Solution for Tower of Hanoi with Breadth First Search Algorithm ? Pin
Christian Graus16-Nov-08 12:58
protectorChristian Graus16-Nov-08 12:58 
GeneralRe: Solution for Tower of Hanoi with Breadth First Search Algorithm ? Pin
Mohammad Dayyan16-Nov-08 16:15
Mohammad Dayyan16-Nov-08 16:15 
GeneralRe: Solution for Tower of Hanoi with Breadth First Search Algorithm ? Pin
Paul Conrad16-Nov-08 17:46
professionalPaul Conrad16-Nov-08 17:46 
Questiondatabind pictureBox control to Northwind Employees table Pin
papori123416-Nov-08 2:25
papori123416-Nov-08 2:25 
Question32Bits Depth Images to 24Bits Depth Image c# Pin
saberbladez16-Nov-08 2:11
saberbladez16-Nov-08 2:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.