private bool AcceptJsonBeforeXml(string[] acceptTypes) { if (acceptTypes != null) foreach (string type in acceptTypes) if (IsJson(type)) return true; else if (IsXml(type)) return false; return false; }