title: Is it possible to assign data type to unknown variable at runtime
body: <p>I am c# silverlight-5 beginner , i have a scenario in which i have used Class Node like this (which works as structure)</p>
  
  <pre><code>   public class Node
      {
          public Node next, left, right;
          public int symbol; // This variable will create problem
          public int freq;
      }public Node front, rear;
  </code></pre>
  
  <p>This class Node is inside another <code>class Huffman</code> Like this</p>
  
  <pre><code>Class Huffman
  {    
         public class Node
          {
              public Node next, left, right;
              public int symbol; // This variable will create problem
              public int freq;
          }public Node front, rear;    
  } 
  </code></pre>
  
  <p>Now what i am doing next is in the constructor of huffman i receive the data type of variable "processingValue" at runtime by constructor invoke from another class. <strong>So the data type of processingValue is decided at run time in constructor call to Huffman by another class</strong>.</p>
  
  <p>And inside the Huffman constructor i have to do something like this:</p>
  
  <pre><code>Class Huffman
  {    
         public class Node
          {
              public Node next, left, right;
              public int symbol; // This variable will create problem
              public int freq;
          }public Node front, rear;  
  
        Huffman(AnotherClass object) //The call from another class is Huffman obj = new Huffman(this);
         {
          temp = new Node();
          temp.symbol = (processingValue); //THIS LINE CREATES PROBLEM  BECAUSE DATA TYPE OF "symbol" is int and may be data type of processingValue could be "short"/"long"/"UInt"etc. 
         }  
  } 
  </code></pre>
  
  <p>Is there any way to type cast the data type of "symbol" make it of "processingValue's" data type ? </p>
  
  <p>I mean in <code>Node Class</code> if i set symbol's data type to <code>"Type"</code> or any other and then i change it's data type in constructor making it same as data type of processingValue ?
  By run time i mean it's a silverlight application and i have comboBox to select from the limited data type (among short/int/long/Uint) on running the program and then the control go to the Huffman constructor with the respective data type selected in combo box</p>
  
  <p>*<em>Is it possibe to do ? *</em> A big thanks for help.</p>