Click here to Skip to main content
15,899,754 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# back up program ? :S Pin
Not Active17-Sep-09 11:28
mentorNot Active17-Sep-09 11:28 
GeneralRe: c# back up program ? :S Pin
booo2222222222222217-Sep-09 11:33
booo2222222222222217-Sep-09 11:33 
GeneralRe: c# back up program ? :S Pin
EliottA17-Sep-09 11:46
EliottA17-Sep-09 11:46 
GeneralRe: c# back up program ? :S Pin
booo2222222222222217-Sep-09 11:51
booo2222222222222217-Sep-09 11:51 
GeneralRe: c# back up program ? :S Pin
EliottA17-Sep-09 11:53
EliottA17-Sep-09 11:53 
GeneralRe: c# back up program ? :S Pin
booo2222222222222217-Sep-09 12:01
booo2222222222222217-Sep-09 12:01 
GeneralRe: c# back up program ? :S Pin
EliottA17-Sep-09 12:03
EliottA17-Sep-09 12:03 
GeneralRe: c# back up program ? :S Pin
booo2222222222222217-Sep-09 12:09
booo2222222222222217-Sep-09 12:09 
GeneralRe: c# back up program ? :S Pin
EliottA17-Sep-09 12:10
EliottA17-Sep-09 12:10 
GeneralRe: c# back up program ? :S Pin
booo2222222222222217-Sep-09 12:12
booo2222222222222217-Sep-09 12:12 
GeneralRe: c# back up program ? :S Pin
Christian Graus17-Sep-09 12:06
protectorChristian Graus17-Sep-09 12:06 
GeneralRe: c# back up program ? :S Pin
booo2222222222222217-Sep-09 12:14
booo2222222222222217-Sep-09 12:14 
GeneralRe: c# back up program ? :S Pin
Christian Graus17-Sep-09 12:33
protectorChristian Graus17-Sep-09 12:33 
GeneralRe: c# back up program ? :S Pin
booo2222222222222217-Sep-09 12:36
booo2222222222222217-Sep-09 12:36 
GeneralRe: c# back up program ? :S Pin
Luc Pattyn17-Sep-09 12:02
sitebuilderLuc Pattyn17-Sep-09 12:02 
GeneralRe: c# back up program ? :S Pin
Not Active17-Sep-09 12:06
mentorNot Active17-Sep-09 12:06 
GeneralRe: c# back up program ? :S Pin
booo2222222222222217-Sep-09 12:13
booo2222222222222217-Sep-09 12:13 
GeneralRe: c# back up program ? :S Pin
EliottA17-Sep-09 12:16
EliottA17-Sep-09 12:16 
GeneralRe: c# back up program ? :S Pin
booo2222222222222217-Sep-09 12:21
booo2222222222222217-Sep-09 12:21 
GeneralRe: c# back up program ? :S Pin
Richard MacCutchan17-Sep-09 23:03
mveRichard MacCutchan17-Sep-09 23:03 
AnswerRe: c# back up program ? :S Pin
Vimalsoft(Pty) Ltd17-Sep-09 20:45
professionalVimalsoft(Pty) Ltd17-Sep-09 20:45 
Questionforeach simple question Pin
JollyMansArt17-Sep-09 10:14
JollyMansArt17-Sep-09 10:14 
AnswerRe: foreach simple question Pin
Ian Shlasko17-Sep-09 10:28
Ian Shlasko17-Sep-09 10:28 
Foreach doesn't loop through the possible indices, but the elements itself... In your first example, you'd actually want something like:
foreach (int i in MyList)
  Messagebox(i);

Assuming MyList is a list of integers... You're looping through the contents, not the indices.

In your second example, foreach wouldn't really help, as it's designed to operate on one element at a time, with no knowledge of the next one... You want a plain old "for," but the trick is to remember the syntax:
for ([initializer]; [condition]; [step])

The "step" part doesn't necessarily have to be just incrementing... You could do this:
for (int i = 0; i < MyList.Count; i += 2)

...to work with every other element in the list.

Proud to have finally moved to the A-Ark. Which one are you in?
Developer, Author (Guardians of Xen)

QuestionRe: foreach simple question Pin
JollyMansArt17-Sep-09 12:04
JollyMansArt17-Sep-09 12:04 
AnswerRe: foreach simple question Pin
PIEBALDconsult17-Sep-09 12:08
mvePIEBALDconsult17-Sep-09 12:08 

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.