I have a list of objects with multiple properties that need to be assigned.
Although I doubt the source of the data is important, I'll include it for background purposes. I'm reading a list of attributes from select nodes in an XmlDocument using a foreach loop. I've created a loop iterator i and I'm trying to assign the values to properties in each object based on the attribute.Name and attribute.Value.
// Reads each attribute: label, type, number etc...
foreach (XmlNode node in myValues.SelectNodes("//Properties"))
{
foreach (XmlAttribute attribute in node.Attributes)
{
//this iterates through the attributes just fine
//and in each iteration attribute.Name = the property
//I want to set and attribute.Value = the value to set it to.
myList[i].label = attribute.Value; //works
//what I'd like to do something like
myList[i].attribute.Name = attribute.Value;
It's driving me nuts. There must be someway to reference the value of attribute.Name?
