public static RuntimeBindingSignature GetTypeSignature(string name, string @namespace, IAssemblyInfo assembly)
        {
            var signature = new RuntimeBindingSignature();

            signature.WriteType(name, @namespace, assembly);
            return(signature);
        }
        public static RuntimeBindingSignature GetAttributeSignature(CustomAttribute attribute)
        {
            var signature = new RuntimeBindingSignature();

            signature.WriteCustomAttribute(attribute);
            return(signature);
        }
        public static RuntimeBindingSignature GetTypeSignature(ITypeInfo type)
        {
            var signature = new RuntimeBindingSignature();

            signature.WriteType(type);
            return(signature);
        }
        public static RuntimeBindingSignature GetFieldSignature(string name)
        {
            var signature = new RuntimeBindingSignature();

            signature.WriteField(name);
            return(signature);
        }
        public static RuntimeBindingSignature GetFieldSignature(IFieldInfo field)
        {
            var signature = new RuntimeBindingSignature();

            signature.WriteField(field);
            return(signature);
        }
        public static RuntimeBindingSignature GetMethodSignature(string name, CallingConventions conventions, params ITypeInfo[] types)
        {
            var signature = new RuntimeBindingSignature();

            signature.WriteMethod(name, conventions, types);
            return(signature);
        }
        public static RuntimeBindingSignature GetMethodSignature(IMethodInfo method)
        {
            var signature = new RuntimeBindingSignature();

            signature.WriteMethod(method);
            return(signature);
        }
        public int GetHashCode(IMethodInfo obj)
        {
            if (obj == null)
            {
                return(0);
            }

            unchecked
            {
                int hash = 17;
                hash = hash * 23 + EqualityComparer <string> .Default.GetHashCode(obj.Name);

                hash = hash * 23 + TypeInfoComparer.Default.GetHashCode(obj.DeclaringType);
                hash = hash * 23 + RuntimeBindingSignature.GetMethodSignature(obj).GetHashCode();
                return(hash);
            }
        }
Exemple #9
0
 public override int GetHashCode()
 {
     return(RuntimeBindingSignature
            .GetAttributeSignature(this)
            .GetHashCode());
 }
Exemple #10
0
        public TypeDefinition GetType(string name, string @namespace)
        {
            var signature = RuntimeBindingSignature.GetTypeSignature(name, @namespace, Assembly);

            return(_typeMapping.Get(signature));
        }
        public FieldDefinition GetField(string name)
        {
            var signature = RuntimeBindingSignature.GetFieldSignature(name);

            return(_fieldMapping.Get(signature));
        }
        public MethodDefinition GetMethod(string name, CallingConventions callConv, params ITypeInfo[] types)
        {
            var signature = RuntimeBindingSignature.GetMethodSignature(name, callConv, types);

            return(_methodMapping.Get(signature));
        }
        public T Get(RuntimeBindingSignature signature)
        {
            T memberRef;

            return(Collection.TryGetValue(signature, out memberRef) ? memberRef : default(T));
        }