Have you got a using directive for System.Linq?
--
Jon Skeet - <sk...@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Yep.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string s = "123,323,4,111";
List<char> lst = s.ToList();
}
}
}
I can confirm the issue.
Is it because ToList is not an extension method for type string but of
IEnumerable<T>? That's the only reason I can think of.
Chris
But the compiler will accept it - and IMO it makes things clearer.
Marc
Anyone willing to install the SP1 beta and try it?
I'd expect it to behave the same way - it sounds unlikely that it's a
bug, and much more likely that it's a feature as Marc suggests. It's
quite rare that you actually want to treat a string as an
IEnumerable<char> in my experience.
It is identical on SP1 beta.
Which by the way is really, really good (IMO). The IDE feels much more
responsive; warnings / errors appear immeditely, for example.
Marc
I'm currently reading "LINQ in Action".
In chapter 4.2.1, it is stated that:
"The extension methods for the System.String are specifically excluded [from
intelliSense] because it is seen as highly unusual to treat a string object
as an IEnumerable<char>."
- José
"Jon Skeet [C# MVP]" <sk...@pobox.com> a écrit dans le message de
news:MPG.2296bc2...@msnews.microsoft.com...