Comments on: C#—-When to use As Keyword in C# https://www.smallworkarounds.com/2008/11/c-when-to-use-as-keyword-in-c.html Welcome to SmallWorkarounds Tue, 21 Mar 2017 07:14:01 +0000 hourly 1 https://wordpress.org/?v=6.8.3 By: Anonymous https://www.smallworkarounds.com/2008/11/c-when-to-use-as-keyword-in-c.html#comment-183 Fri, 13 Nov 2009 12:07:02 +0000 https://www.smallworkarounds.com/index.php/2008/11/17/c-when-to-use-as-keyword-in-c/#comment-183 wouldn't raise
(foo as Bar).Property
a Null Reference Exception if foo is not type compatible with Bar thus "As" will return Null?

]]>
By: Claus Jørgensen https://www.smallworkarounds.com/2008/11/c-when-to-use-as-keyword-in-c.html#comment-168 Sun, 16 Aug 2009 10:09:42 +0000 https://www.smallworkarounds.com/index.php/2008/11/17/c-when-to-use-as-keyword-in-c/#comment-168 Another advantage is syntax 😉

(foo as Bar).Property

versus:

((Bar)foo).Property

]]>
By: Anonymous https://www.smallworkarounds.com/2008/11/c-when-to-use-as-keyword-in-c.html#comment-118 Fri, 13 Mar 2009 11:13:00 +0000 https://www.smallworkarounds.com/index.php/2008/11/17/c-when-to-use-as-keyword-in-c/#comment-118 “As” a quite slower then to use (ClassName) notation, so you should avoid it 🙂

]]>