I don't belive in my eyes. I wrote a foreach to change a bool value... (bool FileEntry.selected)
int i=-1;
foreach (FileEntry itmFile, fileList)
{
i++;
if((tmpType=="alle")||(itmFile.type==tmpType)) //Stimmt Typ?
{
if(itmFile.size+currentSize<maxSize) //Begrenzung noch nicht überschritten?
{
currentSize += itmFile.size;
//itmFile.selected=true; //wird ausgewählt
fileList[i].selected=true;
continue;
}
}
//itmFile.selected=false; //wird nicht ausgewählt
fileList[i].selected=false;
}
int i=-1;
foreach (FileEntry itmFile, fileList)
{
i++;
if((tmpType=="alle")||(itmFile.type==tmpType)) //Stimmt Typ?
{
if(itmFile.size+currentSize<maxSize) //Begrenzung noch nicht überschritten?
{
currentSize += itmFile.size;
//itmFile.selected=true; //wird ausgewählt
fileList[i].selected=true;
continue;
}
}
//itmFile.selected=false; //wird nicht ausgewählt
fileList[i].selected=false;
}
To copy to clipboard, switch view to plain text mode
..and the (now) commted entries like "itmFile.selected=true" change the value only for/in the foreach! After the foreach is done, the value is false, like before. But when i use something like "fileList[i].selected=true", the value is after leaving the foreach is still 'true'. Is that normal???
thx.cit
Bookmarks