public void SetItem <T>(string name, T value) { property = new ObjectItemValue { Name = name, Value = value }; SetItemOnInstance(); }
public ObjectItem(object instance, string name, Dictionary <System.Type, string> typeMapping) { this.instance = instance; this.typeMapping = typeMapping; property = new ObjectItemValue(); itemProperty = instance.GetType().GetProperty(name); itemValue = itemProperty.GetValue(instance, null) as object; Initialize(); }
public ObjectItem(object instance, string name, Dictionary <System.Type, string> typeMapping) { this.instance = instance; this.typeMapping = typeMapping; property = new ObjectItemValue(); itemProperty = instance.GetType().GetProperty(name) ?? throw new ArgumentException("The name must match to a property.", nameof(name)); itemValue = itemProperty.GetValue(instance, null) as object; Initialize(); }
public ObjectItem(object instance, string name) { this.instance = instance; property = new ObjectItemValue(); itemProperty = instance.GetType().GetProperty(name); itemElementNameProperty = instance.GetType().GetProperty(name + "ElementName"); itemValue = itemProperty.GetValue(instance, null) as object; itemElementNameValue = (U)itemElementNameProperty.GetValue(instance, null); Initialize(); }
public ObjectItem(object instance, string name) { this.instance = instance; property = new ObjectItemValue(); itemProperty = instance.GetType().GetProperty(name) ?? throw new ArgumentException("The name must match to a property.", nameof(name)); itemElementNameProperty = instance.GetType().GetProperty(name + "ElementName") ?? throw new ArgumentException("The name must match to a property ending with \"ElementName\".", nameof(name)); itemValue = itemProperty.GetValue(instance, null) as object; itemElementNameValue = (U?)itemElementNameProperty.GetValue(instance, null); Initialize(); }