本文整理汇总了C#中System.Reflection.MethodInfo.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# MethodInfo.GetHashCode方法的具体用法?C# MethodInfo.GetHashCode怎么用?C# MethodInfo.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.MethodInfo
的用法示例。
在下文中一共展示了MethodInfo.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WebmethodGroupName
internal static string WebmethodGroupName(MethodInfo method)
{
return String.Format("method_{0}", method.GetHashCode());
}
示例2: AreMethodEquals
/// <summary>
/// The are method equals.
/// </summary>
/// <param name="left">
/// The left.
/// </param>
/// <param name="right">
/// The right.
/// </param>
/// <returns>
/// The are method equals.
/// </returns>
private static bool AreMethodEquals(MethodInfo left, MethodInfo right)
{
if (left.Equals(right))
return true;
// GetHashCode calls to RuntimeMethodHandle.StripMethodInstantiation()
// which is needed to fix issues with method equality from generic types.
if (left.GetHashCode() != right.GetHashCode())
return false;
if (left.DeclaringType != right.DeclaringType)
return false;
ParameterInfo[] leftParams = left.GetParameters();
ParameterInfo[] rightParams = right.GetParameters();
if (leftParams.Length != rightParams.Length)
return false;
for (int i = 0; i < leftParams.Length; i++)
{
if (leftParams[i].ParameterType != rightParams[i].ParameterType)
return false;
}
if (left.ReturnType != right.ReturnType)
return false;
return true;
}
示例3: GenerateFieldName
private static string GenerateFieldName(MethodInfo method)
{
return String.Format(FieldNameFormat, method.GetHashCode(), method.Name);
}