我需要通过Tag类在BFrame类内设置Value属性。
我该如何设置
Value
所有物
澄清:
我不想设置
Frame
中的属性
Tag
类,但
价值
的属性
框架
类型为的属性
BFrame
。
class BFrame
{
string Value{get; set;}
}
class Tag
{
BFrame Frame{get;}
}
public void func(Tag tag, string newValue)
{
PropertyInfo frameProperty = tag.GetType().GetProperty("Frame");
var oldValue = frameProperty.GetValue(tag);
//frameProperty.SetValue(tag, newValue); //Doesn't work. Throws exception because there is no setter
//TODO: Set the Value property inside the BFrame class
//Somethig like this: tag.Frame.Value = newValue;
}