title: Reassign or replace a variable's type in C#
body: <p>This is something I would need to do to create a flexible logic structure that I need for a class.</p>
  
  <p>The class is like this:</p>
  
  <pre><code>public class myclass {
    public Action myaction;
    public int actionparams;
    public string label;
  
    public void myactionfunction() {
      //do void parameter action
    }
  
    public void myactionfunction(int myparam) {
      //do one parameter action
    }
  
    public void myactionfunction(int myparam, int myparam2) {
      //do two parameter action
    }
  }
  </code></pre>
  
  <p>Well the problem I'm facing is that I will use this class where 'myaction' can arbitrarily require none or as much as six parameters. Since 'Action' needs to be defined for each parameter it's meant to support, I could certainly define as much 'myactions' that I expect parameters for, but that would not be ideal, since I'd need to hardwire parameter types there.</p>
  
  <p>I am hoping that there's a way in which I could 'simply' reassign myaction's type, so that in some manner I can do something like</p>
  
  <pre><code>myaction.type = Action&lt;string,int,int&gt;; //i know this looks bad, but should give the idea
  </code></pre>
  
  <p>I have read about delegate declarations, but can't figure if there's a way to use them for my purpose.</p>
  
  <p>Thanks.</p>