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

Atsushi Eno atsushieno at veritas-vos-liberabit.com
Mon May 10 22:56:24 EDT 2010


As I have commented earlier, there is no chance that 
InvalidCastException could occur, so it is an extraneous suggestion to 
not use isinst here.

Atsushi Eno

On 2010/05/11 8:54, "Andrés G. Aragoneses" wrote:
> 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