Exemplo n.º 1
0
        public static TTarget GetValueConnectedTry <TSource, TTarget>(this IReadOnlyDecoration sourceDecoration, DecorationKey <TSource> sourceDecorationKey,
                                                                      Func <TSource, TTarget> transformer, out bool found)
        {
            TTarget targetValue;

            found = sourceDecoration.TryGetValueConnected(sourceDecorationKey, transformer, out targetValue);
            return(targetValue);
        }
Exemplo n.º 2
0
        public static bool TryGetValueConnected <TSource, TTarget>(this IReadOnlyDecoration sourceDecoration, DecorationKey <TSource> sourceDecorationKey,
                                                                   Func <TSource, TTarget> transformer, out TTarget targetValue)
        {
            TSource sourceValue;
            bool    found = sourceDecoration.TryGetValue(sourceDecorationKey, out sourceValue);

            targetValue = found ? transformer(sourceValue) : default(TTarget);
            return(found);
        }