Barbari Michael
Barbari Michael

Reputation: 31

Trying to get a processname but the First property does not exist

The line is:

foreach (var handle in EnumerateProcessWindowHandles(
        Process.GetProcessesByName("explorer").First().Id))

But First does not exist:

Error 1 'System.Array' does not contain a definition for 'First' and no extension method 'First' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)

Upvotes: 0

Views: 312

Answers (1)

romanoza
romanoza

Reputation: 4862

Add the reference

using System.Linq;

Upvotes: 1

Related Questions