Guest User

Untitled

a guest
Jul 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. namespace TestThisNull
  2. {
  3. using System;
  4.  
  5. public static class Program
  6. {
  7. private static void Main()
  8. {
  9. var method = typeof(Foo).GetMethod(nameof(Foo.Bar));
  10.  
  11. var action = (Action) Delegate.CreateDelegate(typeof(Action), null, method);
  12. action();
  13. }
  14.  
  15. private class Foo
  16. {
  17. public void Bar()
  18. {
  19. // "Expression is always false" :-DD
  20. Console.WriteLine($"this == null = {this == null}");
  21. }
  22. }
  23. }
  24. }
Add Comment
Please, Sign In to add comment