Beispiel #1
0
            protected bool ParseParameters(IStringConverter inConverter)
            {
                for (int i = 0; i < m_Parameters.Length; ++i)
                {
                    ParameterInfo info = m_Parameters[i];

                    if (i == 0)
                    {
                        m_ContextBind = info.GetCustomAttribute <BindContextAttribute>();
                        if (m_ContextBind != null)
                        {
                            m_ContextOffset = 1;
                            continue;
                        }
                    }

                    Type paramType = info.ParameterType;

                    if (!inConverter.CanConvertTo(paramType))
                    {
                        return(false);
                    }

                    if ((info.Attributes & ParameterAttributes.HasDefault) != 0)
                    {
                        if (m_DefaultArguments == null)
                        {
                            m_DefaultArguments = new object[m_Parameters.Length];
                        }
                        m_DefaultArguments[i] = info.DefaultValue;
                    }
                    else
                    {
                        m_RequiredParameterCount++;
                    }
                }

                return(true);
            }