private IMagickImage ExecuteQuantize(XmlElement element, IMagickImageCollection collection) { Hashtable arguments = new Hashtable(); foreach (XmlElement elem in element.SelectNodes("*")) { arguments[elem.Name] = CreateQuantizeSettings(elem); } if (arguments.Count == 0) { collection.Quantize(); return(null); } else if (OnlyContains(arguments, "settings")) { collection.Quantize((QuantizeSettings)arguments["settings"]); return(null); } else { throw new ArgumentException("Invalid argument combination for 'quantize', allowed combinations are: [] [settings]"); } }