Beispiel #1
0
 public void SetItems(object complexItem, ComplexTypeItems complexTypeItems)
 {
     var listItems = complexTypeItems.CastObj<ListItems>();
     var list = complexItem.CastObj<IList>();
     foreach (var item in listItems.Items)
         list.Add(item);
 }
        public void SetItems(object complexItem, ComplexTypeItems complexTypeItems)
        {
            var dictionaryItems = complexTypeItems.CastObj<DictionaryItems>();
            var keys = dictionaryItems.Keys;
            var values = dictionaryItems.Values;

            var dictionary = complexItem.CastObj<IDictionary>();

            for (var i = 0; i < keys.Count; i++)
                dictionary.Add(keys[i], values[i]);
        }
        public void SetItems(object complexItem, ComplexTypeItems listItems)
        {
            var userDefinedItems = listItems.CastObj<UserDefinedItems>();
            var type = complexItem.GetTypeOfObj();

            var names = userDefinedItems.Names;
            var values = userDefinedItems.Values;

            for (var i = 0; i < names.Count; i++)
                type.GetProperty(names[i]).SetValue(complexItem, values[i]);
        }
Beispiel #4
0
        public void SetItems(object complexItem, ComplexTypeItems complexTypeItems)
        {
            var arrayItems = complexTypeItems.CastObj<ArrayItems>();
            var items = arrayItems.Items;
            var array = complexItem.CastObj<Array>();

            var rankLengths = array.GetIndicies();

            var recursiveFor = RecursiveFor.Prepare(rankLengths);
            var allCombinations = new SimpleList<SimpleList<int>>();
            recursiveFor.Begin(info => allCombinations.Add(info.GetIndexes()));

            if (allCombinations.Count != items.Count)
                throw new Exception(string.Format("Array instance says there should be more than {0} items in this array", items.Count));

            for (var i = 0; i < allCombinations.Count; i++)
            {
                var combination = allCombinations[i];
                var item = items[i];
                array.SetValue(item, combination.ToArray());
            }
        }