I have a field object and I create a list of fields:
class Field { string objectName; string objectType; string fieldName; string fieldValue; //constructor... } List<Field> fieldList = new List<Field>();
Suppose I wanted to query this list to return a collection of distinct object names (to then be inserted into a checkedlistbox. How would I go about doing that?
I imagine some LINQ magic can manage this?
The expression should return a List of distinct object names from the list as defined. I converted it to a list since the docs for the CheckedListBox DataSource property indicated that it needs to implement IList or IListSource, not merely IEnumerable.
If accessing the checkedListBox as a ListControl doesn’t give access to the DataSource (sometimes the docs lie), you could try: