/// <summary> /// Convert a metadata MethodHandle to a integer (that can be round-tripped back into a handle) /// This differs from the above function only be parameter type. /// </summary> public static int ToInt(this MethodHandle handle) { // This is gross, but its the only api I can find that directly returns the handle into a token // The assert is used to verify this round-trips properly int handleAsToken = handle.GetHashCode(); Debug.Assert(handleAsToken.AsHandle().Equals(handle)); return(handleAsToken); }
/// <summary> /// Convert a metadata MethodHandle to a integer (that can be round-tripped back into a handle) /// This differs from the above function only be parameter type. /// </summary> public static int ToInt(this MethodHandle handle) { // This is gross, but its the only api I can find that directly returns the handle into a token // The assert is used to verify this round-trips properly int handleAsToken = handle.GetHashCode(); Debug.Assert(Internal.Runtime.TypeLoader.MetadataReaderExtensions.AsHandle(handleAsToken).Equals(handle)); return(handleAsToken); }
public override int GetHashCode() { return _methodHandle.GetHashCode() ^ _contextTypeInfo.GetHashCode(); }