ToDictionary is a mthod available in List collection which converts any List collection into a Dictionary collection.
For Example: List<string> lst_names = new List<string>()
{
"Rajesh",
"Bhuvan",
"Prakash",
"Reema"
};
var names = lst_names.ToDictionary(g => g, g => true);
if (names.ContainsKey("Rajesh"))
{
Response.Write("Rajesh is present in a list collection");
}
Output: Rajesh is present in a list collection