To make my long story short i had to improvise this code a little:
public class Faerie
{
public string Name;
}
public class Example
{
List<Faerie> faeries = new List<Faerie>() {
new Faerie { Name = "Wild Faerie" } ,
new Faerie { Name = "Smoke Faerie" },
new Faerie { Name = "Red Faerie" }
};
string[] faerieNamesFromInput = new string[] { "White Faerie", "Wild Faerie", "Dark Faerie" };
public Faerie ReturnMatchedFromInput()
{
}
}
How can i return a Fairy object from the fairies list if its name matches a name from the user input? Like for instance, here i want to return the Faerie with name Wild Faerie because it's name matches.Is there a short LINQ way for that or i have to go with for loop?