コード例 #1
0
        public static FacetedList <T> ToFacetedList <T>(this IEnumerable <T> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            FacetedList <T> ret = new FacetedList <T>();

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

            return(ret);
        }
コード例 #2
0
        public FacetedList <T> GetInnerFacet(string Property, string Value)
        {
            if (!facets.ContainsKey(Property))
            {
                throw new ArgumentException(String.Format("The property - {0}, is not in the dictionary", Property));
            }

            if (!facets[Property].ContainsKey(Value))
            {
                throw new ArgumentException(String.Format("The property-value pair {0}-{1} is not present in the dictionary", Property, Value));
            }

            List <T> innerList = facets[Property][Value];

            FacetedList <T> newList = new FacetedList <T>();

            foreach (T obj in innerList)
            {
                newList.Add(obj);
            }

            return(newList);
        }