Catel.MVVM.Converters.ValueConverterGroup.GetTargetType C# (CSharp) Метод

GetTargetType() защищенный Метод

Returns the target type for a conversion operation.
protected GetTargetType ( int converterIndex, Type finalTargetType, bool convert ) : Type
converterIndex int The index of the current converter about to be executed.
finalTargetType System.Type The 'targetType' argument passed into the conversion method.
convert bool Pass true if calling from the Convert method, or false if calling from ConvertBack.
Результат System.Type
        protected virtual Type GetTargetType(int converterIndex, Type finalTargetType, bool convert)
        {
            // If the current converter is not the last/first in the list, 
            // get a reference to the next/previous converter.
            System.Windows.Data.IValueConverter nextConverter = null;
            if (convert)
            {
                if (converterIndex < Converters.Count - 1)
                {
                    nextConverter = Converters[converterIndex + 1];
                    if (nextConverter == null)
                    {
                        throw Log.ErrorAndCreateException<InvalidOperationException>("The Converters collection of the ValueConverterGroup contains a null reference at index: " + (converterIndex + 1));
                    }
                }
            }
            else
            {
                if (converterIndex > 0)
                {
                    nextConverter = Converters[converterIndex - 1];
                    if (nextConverter == null)
                    {
                        throw Log.ErrorAndCreateException<InvalidOperationException>("The Converters collection of the ValueConverterGroup contains a null reference at index: " + (converterIndex - 1));
                    }
                }
            }

            if (nextConverter != null)
            {
                ValueConversionAttribute conversionAttribute = _cachedAttributes[nextConverter];

                // If the Convert method is going to be called, we need to use the SourceType of the next 
                // converter in the list.  If ConvertBack is called, use the TargetType.
                return convert ? conversionAttribute.SourceType : conversionAttribute.TargetType;
            }

            // If the current converter is the last one to be executed return the target type passed into the conversion method.
            return finalTargetType;
        }