コード例 #1
0
ファイル: ObjectItem.cs プロジェクト: tofer/quickbooks-sync
        public void SetItem <T>(string name, T value)
        {
            property = new ObjectItemValue
            {
                Name  = name,
                Value = value
            };

            SetItemOnInstance();
        }
コード例 #2
0
ファイル: ObjectItem.cs プロジェクト: tofer/quickbooks-sync
        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();
        }
コード例 #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();
        }
コード例 #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();
        }
コード例 #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();
        }