Hallo Zusammen,
Ich habe folgendes Problem:
In einer Liste habe ich Bildname (bzw. Bildnummern) gespeichert. In einer Schleife möchte ich nun überprüfen ob dieses Bild schon existiert, nur gibt er mir immer zurück, dass das Bild existiert. Hier mein Code:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| _shopList[countRows].Haendler = Convert.ToInt16(res_HaendlerName[0]); path.Append(@"images\" + _shopList[countRows].Haendler+".gif"); if (File.Exists(path.ToString())) { Console.WriteLine("{0}The target already exists", path); } else {
Console.WriteLine("The target dosn't exists"); } |
In der DebugConsole steht beim Compilieren:
images\208.gifThe target already exists
images\221.gifThe target already exists
images\337.gifThe target already exists
images\137.gifThe target already exists
images\221.gifThe target already exists
images\137.gifThe target already exists
images\61.gifThe target already exists
images\208.gifThe target already exists
images\262.gifThe target already exists
images\262.gifThe target already exists
images\174.gifThe target already exists
images\174.gifThe target already exists
images\71.gifThe target already exists
images\71.gifThe target already exists
images\312.gifThe target already exists
images\312.gifThe target already exists
images\459.gifThe target already exists
images\288.gifThe target already exists
images\94.gifThe target already exists
images\85.gifThe target already exists
images\94.gifThe target already exists
images\208.gifThe target already exists
images\221.gifThe target already exists
images\337.gifThe target already exists
images\137.gifThe target already exists
images\221.gifThe target already exists
images\137.gifThe target already exists
images\61.gifThe target already exists
images\208.gifThe target already exists
images\262.gifThe target already exists
images\262.gifThe target already exists
images\174.gifThe target already exists
images\174.gifThe target already exists
images\71.gifThe target already exists
images\71.gifThe target already exists
images\312.gifThe target already exists
images\312.gifThe target already exists
images\459.gifThe target already exists
images\288.gifThe target already exists
images\94.gifThe target already exists
images\85.gifThe target already exists
images\94.gifThe target already exists
Obwohl im Verzeichnis image nur das Bild 221.gif existiert. Weshalb das?
Moderiert von
Christian S.: Topic aus C# - Die Sprache verschoben am Do 13.03.2008 um 10:55