[Mono-dev] [PATCH] - optimization for System.Xml.XmlNode::SelectSingleNode

"Andrés G. Aragoneses" knocte at gmail.com
Mon May 10 19:54:20 EDT 2010


El 10/05/10 21:06, tom hindle escribió:
> On Mon, 2010-05-10 at 19:28 +0100, Alan McGovern wrote:
>> Why would a c-cast be so much slower than an 'as' cast? Surely they
>> should be equivalent or the c-cast should be faster.
> 
> sorry bad terminology...
> 
> I meant syntactically c-style cast not an actual c-cast. I wasn't sure
> the C# name for it, maybe it called a prefix cast?

I think the correct terminology is "static cast" vs "dynamic cast"
because this is the way it's called in C++ (some time ago I liked to
called the latter "safe cast").

That being said, I second Alan statement (or, question, to be more
correct). And I think a dynamic cast shouldn't be used ever if you're
not checking for null later (otherwise you're replacing the
InvalidCastException chance with a NullReferenceException chance, which
is much worse, uglier, and more incorrect).

Regards,

	Andrés

-- 




More information about the Mono-devel-list mailing list