Mono.AssemblyLocationProvider.CompareName C# (CSharp) Method

CompareName() static private method

static private CompareName ( Mono.Cecil.MethodDefinition candidate, string expected ) : bool
candidate Mono.Cecil.MethodDefinition
expected string
return bool
		static bool CompareName (MethodDefinition candidate, string expected)
		{
			if (candidate.Name == expected)
				return true;

			if (!candidate.HasGenericParameters)
				return false;

			var genStart = expected.IndexOf ('[');
			if (genStart < 0)
				genStart = expected.IndexOf ('<');

			if (genStart < 0)
				return false;

			if (candidate.Name != expected.Substring (0, genStart))
				return false;

			int arity = 1;
			for (int pos = genStart; pos < expected.Length; ++pos) {
				if (expected [pos] == ',')
					++arity;
			}

			return candidate.GenericParameters.Count == arity;
		}