public void AddExtension(Selector selector, Extend extends, Env env) { foreach (var extending in extends.Exact) { Extender match = null; if ((match = _extensions.OfType <ExactExtender>().FirstOrDefault(e => e.BaseSelector.ToString().Trim() == extending.ToString().Trim())) == null) { match = new ExactExtender(extending, extends); _extensions.Add(match); } match.AddExtension(selector, env); } foreach (var extending in extends.Partial) { Extender match = null; if ((match = _extensions.OfType <PartialExtender>().FirstOrDefault(e => e.BaseSelector.ToString().Trim() == extending.ToString().Trim())) == null) { match = new PartialExtender(extending, extends); _extensions.Add(match); } match.AddExtension(selector, env); } if (Parent != null) { Parent.AddExtension(selector, extends, env); } }