public static TypeSelectorBase <T> Set <T>(this TypeSelectorBase <T> selector, Func <T> setter) { ValidateExpression(selector, setter); selector.Setter = setter; return(selector); }
/// <summary> /// Add a strongly typed selector to the /// </summary> /// <typeparam name="T">The type for which this selector is used</typeparam> /// <param name="selector">A TypeSelectorBase implementation for Type T</param> /// <param name="position">Optional parameter - indicates whether you want this type selector to be used first or last in the sequence of available selectors for this type</param> public void AddSelector <T>(TypeSelectorBase <T> selector, SelectorPosition position = SelectorPosition.First) { var activeType = typeof(T); CreateTypeIfNotExists(activeType); if (position == SelectorPosition.First) //If the user wants to add this selector to the front of the list (default), do that { _typeMap[activeType].AddFirst(selector); } else //Otherwise, add this type to the back of the list { _typeMap[activeType].AddLast(selector); } }
/// <summary> /// Add a strongly typed selector to the /// </summary> /// <typeparam name="T">The type for which this selector is used</typeparam> /// <param name="selector">A TypeSelectorBase implementation for Type T</param> /// <param name="position"> /// Optional parameter - indicates whether you want this type selector to be used first or last in /// the sequence of available selectors for this type /// </param> public void AddSelector <T>(TypeSelectorBase <T> selector, SelectorPosition position = SelectorPosition.First) { AddSelector((ITypeSelector)selector, position); }