Click here to Skip to main content
15,906,947 members
Home / Discussions / C#
   

C#

 
GeneralRe: about database Pin
miss YY1-Nov-09 20:40
miss YY1-Nov-09 20:40 
Questionabout tree view Pin
miss YY29-Oct-09 18:35
miss YY29-Oct-09 18:35 
AnswerRe: about tree view Pin
Christian Graus29-Oct-09 18:45
protectorChristian Graus29-Oct-09 18:45 
GeneralRe: about tree view Pin
vivasaayi29-Oct-09 19:09
vivasaayi29-Oct-09 19:09 
QuestionNeed advice and help with editing arraylists Pin
rooster215429-Oct-09 17:17
rooster215429-Oct-09 17:17 
AnswerRe: Need advice and help with editing arraylists Pin
Luc Pattyn29-Oct-09 17:33
sitebuilderLuc Pattyn29-Oct-09 17:33 
GeneralRe: Need advice and help with editing arraylists Pin
rooster215431-Oct-09 14:49
rooster215431-Oct-09 14:49 
GeneralRe: Need advice and help with editing arraylists Pin
Luc Pattyn31-Oct-09 15:17
sitebuilderLuc Pattyn31-Oct-09 15:17 
Hi,

1.
you need more structure in your file, how about:
; comments start with this special character (choose one)
; whereas keywords start with another special character (choose one)
; $TEAM is a keyword, it is followed by the team name
$TEAM red
; players are listed: firstName; lastName; ...
Jan;Van den Broeck; CB; 88
Gill;Bates; ZZ; 00
$TEAM blue
...
; end-of-file marker
EOF


FWIW: others will recommend other syntax, maybe an XML file; I tend to keep things simple here.

2.
define Player and Team class as I told before; then use List<T> where T is Player/Team (ArrayList is outdated, arrays are no good, you don't know the dimension).

3.
for small files, you can get all lines at once into memory using File.ReadAllLines()

4.
use foreach to iterate over the lines, then test first char for ; and $

5.
make sure you have a "current team", to which the "current player" gets added.


BTW: I strongly advice you buy and study a book on C#.

Smile | :)

Luc Pattyn

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


QuestionTake pictures with multiple webcams Pin
toby3129-Oct-09 17:09
toby3129-Oct-09 17:09 
AnswerRe: Take pictures with multiple webcams Pin
Christian Graus29-Oct-09 18:46
protectorChristian Graus29-Oct-09 18:46 
QuestionPressing buttons in a webpage programmatically Pin
Nanostrike29-Oct-09 12:07
Nanostrike29-Oct-09 12:07 
AnswerRe: Pressing buttons in a webpage programmatically Pin
Christian Graus29-Oct-09 12:33
protectorChristian Graus29-Oct-09 12:33 
AnswerRe: Pressing buttons in a webpage programmatically Pin
Naruki30-Oct-09 0:13
Naruki30-Oct-09 0:13 
Questiontext formatting in two language Pin
Milad79429-Oct-09 10:26
professionalMilad79429-Oct-09 10:26 
AnswerRe: text formatting in two language Pin
Abhishek Sur29-Oct-09 10:38
professionalAbhishek Sur29-Oct-09 10:38 
Questionhow to open Image n Video file header in c# Pin
shrikant121329-Oct-09 8:29
shrikant121329-Oct-09 8:29 
AnswerRe: how to open Image n Video file header in c# Pin
Dave Kreskowiak29-Oct-09 10:39
mveDave Kreskowiak29-Oct-09 10:39 
AnswerRe: how to open Image n Video file header in c# Pin
Abhishek Sur29-Oct-09 10:40
professionalAbhishek Sur29-Oct-09 10:40 
GeneralRe: how to open Image n Video file header in c# Pin
Christian Graus29-Oct-09 12:06
protectorChristian Graus29-Oct-09 12:06 
GeneralRe: how to open Image n Video file header in c# Pin
shrikant121329-Oct-09 15:33
shrikant121329-Oct-09 15:33 
GeneralRe: how to open Image n Video file header in c# Pin
Christian Graus29-Oct-09 18:47
protectorChristian Graus29-Oct-09 18:47 
GeneralRe: how to open Image n Video file header in c# Pin
shrikant121330-Oct-09 6:15
shrikant121330-Oct-09 6:15 
QuestionObject.Equals(object one, object two) vs Object.ReferenceEquals(object one, object two) [SOLVED] Pin
CaptainSeeSharp29-Oct-09 8:16
CaptainSeeSharp29-Oct-09 8:16 
AnswerRe: Object.Equals(object one, object two) vs Object.ReferenceEquals(object one, object two) Pin
Ian Shlasko29-Oct-09 8:34
Ian Shlasko29-Oct-09 8:34 
GeneralRe: Object.Equals(object one, object two) vs Object.ReferenceEquals(object one, object two) Pin
Henry Minute29-Oct-09 8:36
Henry Minute29-Oct-09 8:36 

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.