Reputation: 4345
public struct Items
{
public string Id;
public string Name;
}
public Items[] _items = null;
if (_items.Contains("Table"))
{
// i need to check the structure and need to return correponding id
}
and am having a list of variables in my structure variable...
i need to search a Name in the structure(_items) and i want to return the Corresponding Id.
how to do this,
Upvotes: 0
Views: 1123
Reputation: 16616
foreach (Items item in _items)
{
if (item.Name.Contains("search string"))
{
return item.Id;
}
}
Upvotes: 1