Ich brauche eine Liste zu füllen:Fehler beim Hinzufügen eines ersten Punktes zu einer Liste
public class Photo
{
public string PicturePath { get; set; }
public string ThumbPath { get; set; }
public string Description { get; set; }
}
List<Photo> photoList = new List<Photo>();
dieser Code nicht der Wert von _PicturePath bei photoList[z].PicturePath for z = 0
, ist ein gültiger Pfad:
for (int z = 0; z < xTotalNbrShown; z++)
{
photoList[z].PicturePath = _PicturePath;
photoList[z].ThumbPath = _ThumbPath;
photoList[z].Description = MakeALT(FileName);
}
„Index war . aus Bereich muss nicht negativ und kleiner ist als die Größe der Sammlung \ r \ nParameter. Name: index“
Sie haben der Liste keinen Artikel hinzugefügt. Mach es mit 'photoList.Add (neues Foto());' –