|
|
|
date: Thu, 14 Aug 2008 09:04:37 -0700 (PDT),
group: microsoft.public.dotnet.framework
back
Re: .NET 3.5 SP1 causes exception when casting arrays (using .Cast<>)
On Aug 14, 11:08 pm, Jon Skeet [C# MVP] wrote:
> Richard Everett wrote:
> > int[] ints = { 1, 2, 3, 4 };
>
> > string[] strings = ints.Cast<string>().ToArray(); //
>
> Did the above really work before SP1? That would surprise me greatly.
Actually, yes, it did work - it was a consequence of them using
Convert.ChangeType() (and thus IConvertible). As I understand,
previously, Cast() first tried a straightforward cast (via as), and
falled back to Convert if that failed.
date: Thu, 14 Aug 2008 22:54:06 -0700 (PDT)
author: Pavel Minaev
Re: .NET 3.5 SP1 causes exception when casting arrays (using .Cast<>)
On Aug 15, 6:54 am, Pavel Minaev wrote:
> > Richard Everett wrote:
> > > int[] ints = { 1, 2, 3, 4 };
>
> > > string[] strings = ints.Cast<string>().ToArray(); //
>
> > Did the above really work before SP1? That would surprise me greatly.
>
> Actually, yes, it did work - it was a consequence of them using
> Convert.ChangeType() (and thus IConvertible). As I understand,
> previously, Cast() first tried a straightforward cast (via as), and
> falled back to Convert if that failed.
Yes, I've just tried it on a pre-SP1 machine - apologies for adding to
the confusion :(
Jon
date: Fri, 15 Aug 2008 00:49:32 -0700 (PDT)
author: Jon Skeet [C# MVP]
|
|