Get only a single element of a sequence using the Single() method.
Let’s say we have a string array with only one element.
using System;
using System.Linq;
using System.Collections.Generic;
public class Demo {
public static void Main() {
string[] str = { "one" };
string res = str.AsQueryable().Single();
Console.WriteLine(res);
}
}