Exemplo n.º 1
0
        private TInterface EnsureContainer()
        {
            if (_container != null)
            {
                return(_container);
            }

            // Find an item that matches our group
            _container = Items.FirstOrDefault();

            // If no item is found, create a new object and add it to the list
            if (!Equals(_container, default(TInterface)))
            {
                return(_container);
            }
            var container = new TItem();

            if (!(container is TInterface))
            {
                throw new Exception("Could not create a container for the value - the container is not of type " + typeof(TInterface).Name);
            }

            _container       = (TInterface)(object)container;
            _container.Group = _group;
            _realObject.Add(_container);
            return(_container);
        }
Exemplo n.º 2
0
        private IList <string> AddCategories()
        {
            var categories = _Properties.GetMany <string>("CATEGORIES");

            categories.Add("Work");
            categories.Add("Personal");

            var property = new Property();

            property.Group = "CATEGORIES";
            property.SetValue(new string[] { "A", "Few", "More" });
            _Properties.Add(property);

            return(categories);
        }