G
Gary
I'm a bit confused hopefuly someone can help.
I have a text file which stores names and an associated number. Each
line in the text file represents one person, and a semicolon ' ; '
seperates person from associated number.
The associated number is used as a que position reference (i.e. the
person next has the lowest number.)
Here is an example: -
e.g. : filename: people.txt
Tod;232
Sarah;939
Jane;34
Natash;2
I need to do things like : -
- rename a persons name,
- move a person up in the que, or down in the que.
So far I've been using Arrays. To rename a person I would search an
array created from File.ReadAllLines - for an element beginning with
the name in question, split that line into name, and number using
element.split and then simply replace the name, and copy back into the
original array, and then back into the file.
However now i'm looking at moving a person up and down in the que
position I need to be able to search accross name,number pairs and
sort according to number.
Should I be createing my own class called que for instance, so that I
could then create my own methods that would do something like: -
Que.MoveUp(salesmanname)
and Que.MoveDown(salesmanname)
and Que.Rename(salesman original name, salesman new name)
etc...
If so how do i create my own class that works like that?
My main problem at the moment is that I'm finding it hard to sort the
array generated by File.ReadAllLines, according to the que number
(which appears at the end of each line).
I think it would be a lot cleaner if i had my own Que class, but I'm
not sure how to start making one.
Thanks,
Gary.
I have a text file which stores names and an associated number. Each
line in the text file represents one person, and a semicolon ' ; '
seperates person from associated number.
The associated number is used as a que position reference (i.e. the
person next has the lowest number.)
Here is an example: -
e.g. : filename: people.txt
Tod;232
Sarah;939
Jane;34
Natash;2
I need to do things like : -
- rename a persons name,
- move a person up in the que, or down in the que.
So far I've been using Arrays. To rename a person I would search an
array created from File.ReadAllLines - for an element beginning with
the name in question, split that line into name, and number using
element.split and then simply replace the name, and copy back into the
original array, and then back into the file.
However now i'm looking at moving a person up and down in the que
position I need to be able to search accross name,number pairs and
sort according to number.
Should I be createing my own class called que for instance, so that I
could then create my own methods that would do something like: -
Que.MoveUp(salesmanname)
and Que.MoveDown(salesmanname)
and Que.Rename(salesman original name, salesman new name)
etc...
If so how do i create my own class that works like that?
My main problem at the moment is that I'm finding it hard to sort the
array generated by File.ReadAllLines, according to the que number
(which appears at the end of each line).
I think it would be a lot cleaner if i had my own Que class, but I'm
not sure how to start making one.
Thanks,
Gary.