IDE: Visual studio 2010, C#, .NET 4.0, Winforms application. Before I begin see this class:
public class Car
{
private string _break;
public string Break
{
get { return _break; }
set { _break = value; }
}
}
And I have another class:
public class Runner
{
Car cObj = new Car();
string propertyName = "Break";
//cobj.Break = "diskBreak"; I can do this but I have property name in string format
cobj[propertyName] = "diskBreak"; // I have the property name in string format
// and I want to make it's Property format please suggest how to to this?
}
I have the property name in string format and I want to convert this in property and want to initialize it. Please tell me how to perform this, I think it is possible using reflection. But I don't have that knowledge.