Exemplo n.º 1
0
 public static bool TryGetValue <T>(this IReadOnlyNeedle <T> needle, out T target)
 {
     if (needle == null)
     {
         target = default;
         return(false);
     }
     if (needle is ICacheNeedle <T> cacheNeedle)
     {
         return(cacheNeedle.TryGetValue(out target));
     }
     target = ((INeedle <T>)needle).Value;
     return(needle.IsAlive);
 }
Exemplo n.º 2
0
        public static bool TryGetValue <T>(this IReadOnlyNeedle <T> needle, out T target)
        {
            switch (needle)
            {
            case null:
                target = default !;
                return(false);

            case ICacheNeedle <T> cacheNeedle:
                return(cacheNeedle.TryGetValue(out target));

            default:
                target = needle.Value;
                return(needle.IsAlive);
            }
        }
Exemplo n.º 3
0
        public static bool TryGetValue <T>(this IReadOnlyNeedle <T> needle, out T target)
        {
            if (needle == null)
            {
                target = default(T);
                return(false);
            }
            var cacheNeedle = needle as ICacheNeedle <T>;

            if (cacheNeedle != null)
            {
                return(cacheNeedle.TryGetValue(out target));
            }
            target = needle.Value;
            return(needle.IsAlive);
        }
Exemplo n.º 4
0
 public static bool TryGetValue <T>(this IReadOnlyNeedle <T> needle, out T target)
 {
     if (needle == null)
     {
         target = default !;
Exemplo n.º 5
0
 public static TNeedle CreateReadOnlyNestedNeedle <T, TNeedle>(IReadOnlyNeedle <T> target)
     where TNeedle : IReadOnlyNeedle <T>
 {
     return(NestedReadOnlyNeedleCreator <T, TNeedle> .Create(target));
 }
Exemplo n.º 6
0
 public static TNeedle Create(IReadOnlyNeedle <T> target)
 {
     return(_create.Invoke(target));
 }