Example #1
0
        public void SetItem <T>(string name, T value)
        {
            property = new ObjectItemValue
            {
                Name  = name,
                Value = value
            };

            SetItemOnInstance();
        }
Example #2
0
        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();
        }
Example #3
0
        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();
        }
Example #4
0
        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();
        }
Example #5
0
        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();
        }