private static bool MatchesNamespace (MatchAttempt[] attempts, string ns, out string type) { for (int i = 0; i < attempts.Length; ++i) if (ns == attempts [i].Namespace) { type = attempts [i].Type; return true; } type = null; return false; }
private static MatchAttempt[] GetAttempts (string ns, string type) { MatchAttempt[] attempts = new MatchAttempt [Count (ns, '.') + 1]; int wns = 0; for (int i = 0; i < ns.Length; ++i) { if (ns [i] == '.') attempts [wns++] = new MatchAttempt (ns.Substring (0, i), ns.Substring (i+1) + "." + type); } attempts [wns++] = new MatchAttempt (ns, type); return attempts; }