Hi, I have needs to bind different things to comboboxes. The value could be an int, string, guid, who knows. I wanted to create a generic DisplayMemberValueMember class so I can build up a list and bind to it. For example, I'd want to do something like below.
I can't get my class to compile of the code to create the list to work. I am a little new to creating my own classes with generics.
My goal (with any object not just bool):
(code I tried)
var displaymemberlist = new List<DisplayMemberValueMember<int>>();
displaymemberlist.Add(new DisplayMemberValueMember<int>("Client1", 1));
displaymemberlist.Add(new DisplayMemberValueMember<int>("Client2", 1));
I can't figure out how to create the list outside this class.
public class DisplayMemberValueMember<T>
public string DisplayMember;
public T ValueMember;
public DisplayMemberValueMember<T>(string displayMember, object valueMember)
DisplayMember = displayMember;
ValueMember = valueMember;