Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

NonPublic Method Invocation - Part #1

By: a guest on Jan 5th, 2012  |  syntax: C#  |  size: 0.60 KB  |  views: 145  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // SomeClass.cs
  2.  
  3. namespace Reflection
  4. {
  5.     public class SomeClass
  6.     {
  7.         public SomeClass(Invoker invoker)
  8.         {
  9.             invoker.Register(this, "GetPublicMessage", "GetProtectedMessage", "GetPrivateMessage");
  10.         }
  11.  
  12.         public string GetPublicMessage()
  13.         {
  14.             return "This is a public message.";
  15.         }
  16.  
  17.         protected string GetProtectedMessage()
  18.         {
  19.             return "This is a protected message.";
  20.         }
  21.  
  22.         private string GetPrivateMessage()
  23.         {
  24.             return "This is a private message.";
  25.         }
  26.     }
  27. }