fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4.  
  5. namespace ConsoleApp1
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. Console.WriteLine("How many movies you would like to create?");
  12. var value = int.Parse(Console.ReadLine());
  13. List<Movie> movieList = new List<Movie>();
  14.  
  15. for(int i = 1;i <= value;i++)
  16. {
  17. Movie m = new Movie();
  18. Console.WriteLine("Movie Number #" + i);
  19. Console.WriteLine("Title of the Movie?");
  20. m.title = Console.ReadLine();
  21. Console.WriteLine("A little overview?");
  22. m.overview = Console.ReadLine();
  23. Console.WriteLine("Which genres the movie is in?");
  24. m.genre = Console.ReadLine().Split(' ');
  25. Console.WriteLine("What is the release date of the movie?");
  26. m.releaseDate = Console.ReadLine();
  27. Console.WriteLine("-------------------------------------------------");
  28. movieList.Add(m);
  29. }
  30.  
  31. Console.WriteLine("The List of movies you have added");
  32.  
  33. for (int i = 0; i < movieList.Count; i++)
  34. {
  35. Console.WriteLine("Movie Number : #" + (i+1));
  36. Console.WriteLine("Movie Title : " + movieList[i].title);
  37. Console.WriteLine("Movie Overview : " + movieList[i].overview);
  38. Console.WriteLine("Movie Genre : " + string.Join(" | ", movieList[i].genre));
  39. Console.WriteLine("Movie ReleaseDate : " + movieList[i].releaseDate);
  40. Console.WriteLine("-------------------------------------------------");
  41. }
  42.  
  43. Console.Read();
  44. }
  45. }
  46.  
  47. class Movie
  48. {
  49. public string title { get; set; }
  50. public string overview { get; set; }
  51. public string[] genre { get; set; }
  52. public string releaseDate { get; set; }
  53. }
  54. }
Runtime error #stdin #stdout #stderr 0.01s 135488KB
stdin
Standard input is empty
stdout
How many movies you would like to create?
stderr
Unhandled Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: String
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00006] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Int32.Parse (System.String s) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0 
  at ConsoleApp1.Program.Main (System.String[] args) [0x0000f] in <ce449b704fc24623b8dfd7ea83199377>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
Parameter name: String
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00006] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Int32.Parse (System.String s) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0 
  at ConsoleApp1.Program.Main (System.String[] args) [0x0000f] in <ce449b704fc24623b8dfd7ea83199377>:0