title: C# - Casting an 'object' parameter into that object's type?
body: <p>C#</p>
  
  <p>Hi all,</p>
  
  <p>I pass an object to a method.</p>
  
  <p><b>I want to cast that object to its specific class so I can perform its own specific methods? How can I do that?</b></p>
  
  <pre><code>Move( new Cat() );
  Move( new Pigeon() );
  
  public void Move(object objectToMove)
  {
      if(objectToMove== Cat)
      {
          Cat catObject = objectToMove as Cat;
          catObject.Walk();
      }
      else if(objectToMove== Pigeon)
      {
          Rat pigeonObject = objectToMove as Pigeon;
          pigeonObject.Fly();
      }
  }
  </code></pre>