Ce code :
me génère une erreur de type NullReferenceException
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 public class Store { public Album[] albums ; public Client[] clients; public CreditCard[] creditC; public Store() { albums = new Album[5]; clients = new Client[5]; creditC = new CreditCard[5]; int i = albums.Length; albums[0].id = 1; albums[0].name = "xxx"; albums[0].avQty = 10; albums[0].unitPrice = 1500; albums[1].id = 2; albums[1].name = "yyy"; albums[1].avQty = 10; albums[1].unitPrice = 1500; albums[2].id = 3; albums[2].name = "zzz"; albums[2].avQty = 10; albums[2].unitPrice = 1500; albums[3].id = 4; albums[3].name = "aaa"; albums[3].avQty = 10; albums[3].unitPrice = 1500; albums[4].id = 5; albums[4].name = "ddd"; albums[4].avQty = 10; albums[4].unitPrice = 1500; } }
Partager