public AttachedClrPropertyImplementation(IPlatformMetadata platformMetadata, string name, MethodInfo getMethod, MethodInfo setMethod) : base(platformMetadata)
        {
            Type valueType;
            Type type;

            if (getMethod == null && setMethod == null)
            {
                throw new ArgumentNullException();
            }
            this.name      = name;
            this.getMethod = getMethod;
            this.setMethod = setMethod;
            if (this.getMethod == null)
            {
                ParameterInfo[] parameters = this.setMethod.GetParameters();
                valueType = PlatformTypeHelper.GetValueType(parameters[0]);
                type      = PlatformTypeHelper.GetValueType(parameters[1]);
            }
            else
            {
                valueType = PlatformTypeHelper.GetValueType(this.getMethod.GetParameters()[0]);
                type      = PlatformTypeHelper.GetValueType(this.getMethod);
            }
            this.targetType = (valueType != null ? valueType : typeof(DependencyObject));
            this.valueType  = (type != null ? type : typeof(object));
            this.isResolved = type != null;
        }
Пример #2
0
 private IList <IParameter> GetArguments(System.Reflection.MethodBase method)
 {
     ParameterInfo[] parameters = method.GetParameters();
     IParameter[]    parameter  = new IParameter[(int)parameters.Length];
     for (int i = 0; i < (int)parameters.Length; i++)
     {
         ParameterInfo parameterInfo = parameters[i];
         Type          valueType     = PlatformTypeHelper.GetValueType(parameterInfo);
         IType         type          = null;
         if (valueType != null)
         {
             type = this.typeResolver.GetType(valueType);
         }
         if (type == null)
         {
             type = this.typeResolver.ResolveType(PlatformTypes.Object);
         }
         parameter[i] = new BaseMethod.Parameter(type, parameterInfo.Name);
     }
     return(new ReadOnlyCollection <IParameter>(parameter));
 }