April 2006 - Posts - Pann's Thoughts

April 2006 - Posts

When casting (in C#) you generally have two options.

  • (Foo)myObj
  • myObj as Foo
  • Typicall, when I’m going to cast only one once and want to call a method on the casted object, I use

    ((Foo)myObj).Bar()

    The other day, I saw someone write

    (myObj as Foo).Bar()

    Which do you use (Vote here)

     

    Posted by roaan | 5 comment(s)
    Filed under: