示例#1
0
        /// <summary>
        /// Convert an IL field reference to an XFieldReference.
        /// </summary>
        public static XFieldReference AsFieldReference(XModule module, FieldReference field)
        {
            var             cache = module.GetCache <FieldReferenceCache>();
            XFieldReference result;

            if (cache.TryGetValue(field, out result))
            {
                return(result);
            }

            result       = CreateFieldReference(module, field);
            cache[field] = result;
            return(result);
        }
示例#2
0
        /// <summary>
        /// Convert an IL method reference to an XMethodReference.
        /// </summary>
        public static XMethodReference AsMethodReference(XModule module, MethodReference method)
        {
            var cache = module.GetCache <MethodReferenceCache>();
            XMethodReference result;

            if (cache.TryGetValue(method, out result))
            {
                return(result);
            }

            result        = CreateMethodReference(module, method);
            cache[method] = result;
            return(result);
        }
示例#3
0
        /// <summary>
        /// Convert an IL type reference to an XTypeReference.
        /// </summary>
        public static XTypeReference AsTypeReference(XModule module, TypeReference type)
        {
            if (type == null)
            {
                return(null);
            }

            var            cache = module.GetCache <TypeReferenceCache>();
            XTypeReference result;

            if (cache.TryGetValue(type, out result))
            {
                return(result);
            }

            result      = CreateTypeReference(module, type);
            cache[type] = result;
            return(result);
        }