Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
 public override int GetHashCode()
 {
     return _methodHandle.GetHashCode() ^ _contextTypeInfo.GetHashCode();
 }