fork(7) download
  1. using System;
  2. public class Person
  3. {
  4. public String Name { get; set; } = "John";
  5. }
  6.  
  7. public class Classroom
  8. {
  9. public Person GetTeacher()
  10. {
  11. return null;
  12. }
  13. }
  14.  
  15. public class Test
  16. {
  17. public static void Main()
  18. {
  19. Classroom classroom = new Classroom();
  20. var teacherName = classroom.GetTeacher().Name;
  21. }
  22. }
Runtime error #stdin #stdout #stderr 0.03s 26808KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at Test.Main () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at Test.Main () [0x00000] in <filename unknown>:0