fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Collections;
  7.  
  8. namespace coolpc
  9. {
  10. public class category
  11. {
  12. public int ctId;
  13. public string ctName;
  14. //請問要怎麼把pdList宣告為product型別的ArrayList?
  15. public (product)ArrayList pdList;
  16. //或者,c#有沒有其他container接近於vector可以設定型別的? 拜託不要List...
  17. public void addPd(product i){
  18. pdList.Add(i);
  19. }
  20. }
  21.  
  22. public class product
  23. {
  24. public int pdId;
  25. public string pdName;
  26. public string category;
  27. public int ctId;
  28. public string title;
  29. public int price;
  30. public string imgUrl;
  31. public int realPrice;
  32. public string pdIntro;
  33. }
  34. }
  35.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(15,16): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
prog.cs(15,24): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration
Compilation failed: 2 error(s), 0 warnings
stdout
Standard output is empty