質問するログイン新規登録

質問編集履歴

2

追記&修正

2019/12/25 07:33

投稿

Y0241-N
Y0241-N

スコア1066

title CHANGED
@@ -1,1 +1,1 @@
1
- 【Unity】【C#】独自クラスの要素すべてをforeachを使ってDebug.Logに表示したい
1
+ 【Unity】【C#】独自クラスの異なる型のすべての要素取り出して表示したい
body CHANGED
File without changes

1

追記&修正

2019/12/25 07:33

投稿

Y0241-N
Y0241-N

スコア1066

title CHANGED
File without changes
body CHANGED
@@ -17,11 +17,17 @@
17
17
  public int Quantity{get; set;}
18
18
  public string ProductName{get; set;}
19
19
  }
20
- public List<CustumData> ProductList; ←すでに複数の異なるCustuDataを持っているとする
20
+ public List<CustumData> ProductList;
21
21
 
22
+ ProductListの中身は例として以下のような状態とする。
23
+ ProductList[0] = 5,10,pen
24
+ ProductList[1] = 2,7,desk
25
+ ProductList[2] = 8,45,watch
26
+ ProductList[3] = 14,3,sword
27
+
22
28
  foreach(var a in ProductList)
23
29
  {
24
- 次にaの中身をすべて取り出して表示したい
30
+ 各ProductList[n]の中身をすべて出したい
25
31
  }
26
32
 
27
33
  ```