I got a list of columns in the variable ParentColumnNames, i need to find a single Column object within this list using the selectedvalue of another combobox. How can i get that? Please help...
List&开发者_JAVA技巧lt;Columns> ParentColumnNames = new List<Columns>();
ParentColumnNames = metadataobj.GetColumns(cbParentTable.SelectedItem.ToString());
within this i need to find single object using cbParentColumn.SelectedValue.
Try something like this:
ParentColumnNames.Where(x => x.Name == cbParentColumn.SelectedValue).FirstOrDefault();
My answer assumes that the Columns
class has a property Name
and that this property contains the value you are looking for.
精彩评论