title: Passing an unknown class as a parameter (C#)
body: <p>I've written a class to detect for button presses on my UI, and it does nothing else. When the code runs, the UI manager class I've written looks for buttons and stores them in a list.</p>
  
  <p>The problem I have is that I want the different buttons to have different functionality, but all be executed from the same UI manager. I have a third class called 'button info', which I'd like to hold a reference to the function class for the button, but I can't work out how to do it.</p>
  
  <p>Basically, I'd like the button class to be something like this:</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  
  public class ButtonInfo
  {
      public int States;
      public int CurrentState;
      public int Animations;
      public void ButtonFunction&lt;T&gt;(); &lt;--- This is the issue!
  }
  </code></pre>
  
  <p>This is in the Unity Engine, so can't use the latest features of C#, but I'm sure this must be possible.</p>
  
  <p>I'd like the 'ButtonFunction' in the class above to have the ability to carry any class without being specific.</p>
  
  <p>Is it possible?</p>
  
  <p>Cheers,</p>
  
  <p>C.</p>