fork(3) 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 = null;
  20. var teacherName = classroom?.GetTeacher()?.Name;
  21. System.Console.WriteLine(teacherName == null);
  22. }
  23. }
Success #stdin #stdout 0.03s 23872KB
stdin
Standard input is empty
stdout
True