Exemple #1
0
        /// <summary>
        /// Tries to resolve the given managed method to function reference.
        /// </summary>
        /// <param name="method">The method to resolve.</param>
        /// <param name="handle">The resolved function reference (if any).</param>
        /// <returns>True, if the requested function could be resolved.</returns>
        public bool TryGetMethodHandle(MethodBase method, out MethodHandle handle)
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }

            // Synchronize all accesses below using a read scope
            using var readScope = irLock.EnterUpgradeableReadScope();

            return(methods.TryGetHandle(method, out handle));
        }
Exemple #2
0
        /// <summary>
        /// Tries to resolve the given managed method to function reference.
        /// </summary>
        /// <param name="method">The method to resolve.</param>
        /// <param name="handle">The resolved function reference (if any).</param>
        /// <returns>True, if the requested function could be resolved.</returns>
        public bool TryGetMethodHandle(MethodBase method, out MethodHandle handle)
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }

            irLock.EnterReadLock();
            try
            {
                return(methods.TryGetHandle(method, out handle));
            }
            finally
            {
                irLock.ExitReadLock();
            }
        }