Exemple #1
0
        public readonly string MethodSigString; // return type : (parameter types)

        #endregion Fields

        #region Constructors

        public MethodDescriptor(RemoteReflector reflector, MethodInfo info, TypeDescriptor declaringType, Guid id)
            : base(reflector, id)
        {
            this.DeclaringType = declaringType;
            this.MethodName = info.Name;
            this.MethodAttributes = info.Attributes;

            // signature is null - will be created when first needed

            var sb = new StringBuilder();

            TypeToString(sb, info.ReturnType);

            sb.Append('(');
            ParameterInfo[] parameters = info.GetParameters();
            for (int i = 0; i < parameters.Length; i++)
            {
                if (i > 0) sb.Append(',');
                TypeToString(sb, parameters[i].ParameterType);
            }
            sb.Append(')');

            this.MethodSigString = sb.ToString();
        }
Exemple #2
0
 public TypeDescriptor(RemoteReflector reflector, TypeDescriptor declaringType, Type type, Guid id)
     : base(reflector, id)
 {
     this.DeclaringType = declaringType;
     this.TypeName = type.FullName;
     this.IsValueType = type.IsValueType;
     this.IsDelegate = typeof(Delegate).IsAssignableFrom(type);
     this.TypeAttributes = type.Attributes;
 }
Exemple #3
0
        private TypeDescriptor GetDescriptorForType(Dictionary<Type, TypeDescriptor> map, Type type)
        {
            TypeDescriptor type_desc;
            if (!map.TryGetValue(type, out type_desc))
            {
                Guid id = Guid.NewGuid();

                if (type.IsNested)
                {
                    TypeDescriptor declaring_type_desc = GetDescriptorForType(map, type.DeclaringType);
                    type_desc = new TypeDescriptor(this, declaring_type_desc, type, id);
                }
                else
                {
                    type_desc = new TypeDescriptor(this, type, id);
                }

                typeMap.Add(id, type);
            }
            return type_desc;
        }