The project I am developing was created in visual studio 2010. I would like to make a small addition to this project. I need to use nameof function to pass data to combobox. But, Visual studio 2010 doesn't include nameof function.
public partial class Form1 : Form
{
ComboBox _comboBox;
List<Instructor> _instructors;
public Form1()
{
//InitializeComponent();
var set = new HashSet<Instructor>(new InstructorComparer());
var xml = XElement.Load("test.xml");
foreach (var node in xml.Elements("Test").Elements("Instructor"))
{
var instructor = new Instructor
{
Num = (int)node.Attribute("Num"),
Name = node.Element("Name").Value
};
set.Add(instructor);
}
_instructors = set.ToList();
_comboBox.DisplayMember = nameof(Instructor.Num);
_comboBox.DataSource = _instructors;
}
}
What solutions do you have for this problem? thanks