Recipe 3.13. Determining When to Use the Cast Operator, the as Operator, or the is OperatorProblemYou need to determine which operator is best in your situationthe cast (type) operator, the as operator, or the is operator. SolutionUse the information provided in the Discussion section to determine which operator is best to use. DiscussionUse the cast operator when:
Use the as operator when:
Use the is operator when:
See AlsoSee Recipes 3.14 and 3.15; see the "( ) Operator," "as Operator," and "is Operator" topics in the MSDN documentation. |