Home > Blockchain >  Map List items with IEnumerable interface
Map List items with IEnumerable interface

Time:03-26

The System.Collections.Generic.List type implements IEnumerable, so I should be able to call Select or use a from expression, but doing so the compiler complains it is not supported.

I tried this in enter image description here

CodePudding user response:

The Select is an extension method. In order for the C# compiler to pick up this method you must add a using statement.

using System.Linq;

With this, your code now compiles.

  • Related