I have a simple Class containing 3 fields. Is there a way I can obtain the value of a field by knowing one of the others? For example, I know the sysColor.name but I need to get the corresponding value of sysColor.id? In a similar way as you would use Dictionary[key] = value.
class SystemColor
{
public string name;
public ElementId id;
public Color color;
public SystemColor(Material material)
{
name = material.Name;
id = material.Id;
color = material.Color;
}
}
Edit:
List<SystemColor> sysColorList = new List<SystemColor>();
foreach (Material mat in collector)
{
SystemColor sysColor = new SystemColor(mat);
sysColorList.Add(sysColor);
}
Yes, I have a list of the classes.
I'm collection all of the materials in a project. Then i'm checking the names against a collection of systems. If the material doesn't exist, I'm creating it. Later, when the user updates the color of a material, I want to change the BackColor of a listView to match. The name of the system matches the name of the color. So I need the color field of the corresponding name field.