main
 1using System.Collections.Generic;
 2using System.Linq;
 3
 4namespace solidware.financials.service.domain.property_bag
 5{
 6    public class PropertyBagWithoutTarget<T> : PropertyBag
 7    {
 8        IEnumerable<Property> all_properties;
 9
10        public PropertyBagWithoutTarget()
11        {
12            all_properties = typeof (T).GetProperties().Select(x => (Property) new PropertyReference<T>(x));
13        }
14
15        public Property property_named(string name)
16        {
17            if (all_properties.Any(x => x.represents(name)))
18                all_properties.Single(x => x.represents(name));
19            return new UnknownProperty();
20        }
21
22        public IEnumerable<Property> all()
23        {
24            return all_properties;
25        }
26    }
27}