METHOD
Enumerable.Single
Requires exactly one match.
Formal Syntax & Structure
csharp syntaxcsharp
source.Single(predicate)Working Example
Example Snippetcsharp
using System;using System.Linq;int n = new[] {1,2}.Single(x => x == 2);Requires exactly one match.
source.Single(predicate)using System;using System.Linq;int n = new[] {1,2}.Single(x => x == 2);