3

In a different question (How to split a number into individual digits?), they call the Select method on a string. This site also suggests that it is possible.

However, when I try to do this using the code samples found in either of those places, I get a compile error. What could be causing this, and how can I use the Select method on a string?

Community
  • 1
  • 1
Patrick
  • 1,894
  • 3
  • 15
  • 17

3 Answers3

12

This is a LINQ method.

To use it, you need to be using .Net 3.5 or later, have referenced System.Core.dll, and have using System.Linq.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
2

Are you sure you have included the System.Linq reference?

using System.Linq;

Josh Anderson
  • 5,975
  • 2
  • 35
  • 48
1

Just Add a reference system.core.dll

1.In Solution Explorer, right-click on the project node and click Add Reference.

2.In the Add Reference dialog box, select the tab indicating the type of component you want to reference.

3.On .NET tab Select System.Core, then click OK.

And add using System.Linq on what the example you provided;

and make sure that youre project framework is 3.5 because it will not work on lower versions.

Regards

Crimsonland
  • 2,194
  • 3
  • 24
  • 42