fork download
  1. {
  2. class Problems
  3. {
  4. List<Problem> allProblems;
  5. public string sugprice;
  6. public Problems()
  7. {
  8. allProblems = new List<Problem>();
  9. allProblems = readProblems();
  10. }
  11.  
  12. public List<Problem> readProblems()
  13. {
  14. List<Problem> spisok = new List<Problem>();
  15. foreach (string line in File.ReadLines(@"problems.txt", Encoding.UTF8))
  16. {
  17. string[] pr = line.Split(new string[] { "-||-" }, StringSplitOptions.None);
  18. Problem temp = new Problem(pr[0], pr[1], pr[2]);
  19. spisok.Add(temp);
  20. }
  21. return spisok;
  22. }
  23. public List<Problem> getProblems()
  24. {
  25. return allProblems;
  26. }
  27. public Problem findByProb(string str)
  28. {
  29. Problem temp = allProblems.Find(x => x.prob == str);
  30. return temp;
  31. }
  32. public void saveProblems()
  33. {
  34. StreamWriter afile = new StreamWriter("problems.txt", false, Encoding.UTF8);
  35. foreach (Problem p in allProblems)
  36. {
  37. afile.WriteLine("{0}-||-{1}-||-{2}", p.ID, p.prob, p.sugprice);
  38. }
  39. afile.Close();
  40. }
  41.  
  42. public Problem findByID(int ID)
  43. {
  44. return allProblems.Find(x => x.ID == ID);
  45. }
  46. }
  47. class Problem
  48. {
  49. public int ID;
  50. public string prob;
  51. public string sugprice;
  52. public Problem(string ID, string prob, string sugprice)
  53. {
  54. this.ID = Int32.Parse(ID);
  55. this.prob = prob;
  56. this.sugprice = sugprice;
  57. }
  58. }
  59. }
  60.  
  61. private void buildProblemsBox() // формируем выпадающий список
  62. {
  63. foreach (Problem p in problems.getProblems()) // Функция возвращает текущий список проблем
  64. {
  65. problemCombo.Items.Add(p.prob +" "+ p.sugprice);
  66. }
  67. }
  68.  
  69. private void problemCombo_SelectedIndexChanged(object sender, EventArgs e)
  70. {
  71. priceBox.Text = p.sugprice;
  72.  
  73. }
  74.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,0): error CS1525: Unexpected symbol `{'
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty