示例#1
0
        public Boolean Copy(Object source, Object target)
        {
            if (CollectionAppender <TCollection, Object> .Supported)
            {
                var facade = new CollectionAppender <TCollection, Object>((TCollection)target);
                facade.Clear();

                foreach (var item in (IEnumerable)source)
                {
                    facade.Add(item);
                }

                return(true);
            }

            return(false);
        }
示例#2
0
        public Boolean Populate(JsonReader reader, Object target)
        {
            if (CollectionAppender <TCollection, Object> .Supported)
            {
                var facade = new CollectionAppender <TCollection, Object>((TCollection)target);
                reader.ReadStartArray();

                while (reader.Peek() != JsonToken.EndArray)
                {
                    facade.Add(reader.ReadValue <Object>());
                }

                reader.ReadEndArray();

                return(true);
            }

            return(false);
        }