Exemplo n.º 1
0
        public IPrim this[string name] {
            get {
                if (!PrimExists(name))
                {
                    throw new Exception("Unable to look up primitive. " + name + " does not resolve to a known primitive.");
                }
                IEnumerable <IPrim> primsWithName = _prims.Where(prim => prim.Name.Equals(name));
                if (primsWithName.Count() > 1)
                {
                    throw new Exception("Unable to look up primitive. The are more than one primitives called " + name + ". Use GetPrimsWithName() instead.");
                }

                return(primsWithName.First());
            }
        }