title: Should I use (ObjectType) or 'as ObjectType' when casting in c#?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2483/casting-newtype-vs-object-as-newtype">Casting: (NewType) vs. Object as NewType</a>  </p>
  </blockquote>
  
  <p>Say for example I have a class called MyObjectType and I want to convert the sender parameter of an event to this type. I would usually go about it by simply doing this:</p>
  
  <pre><code>MyObjectType senderAsMyType = (MyObjectType) sender;
  </code></pre>
  
  <p>I've recently realised that it can also be done like this:</p>
  
  <pre><code>MyObjectType senderAsMyType = sender as MyObjectType;
  </code></pre>
  
  <p>Which way is most efficient? So that I can make my code consistent and use one of the ways throughout. Or do they both have pro's and cons? If so please could someone inform me of them.</p>
  
  <p>Thanks again,</p>