public static bool TryGet(this IProcessorContext context, Type type, out object value) { if (context == null) { throw new ArgumentNullException("context"); } var result = context.TryGet(type, out value, ProcessorContextKeys.Default); return(result); }
public static object Get(this IProcessorContext context, Type type, string key) { if (context == null) { throw new ArgumentNullException("context"); } object value; if (!context.TryGet(type, out value, key)) { throw new ArgumentOutOfRangeException("key", key, string.Format(Resources.KeyNotFoundForGivenType, key, type.FullName)); } return(value); }
public static bool TryGet <T>(this IProcessorContext context, out T value, string key) { if (context == null) { throw new ArgumentNullException("context"); } object obj; var result = context.TryGet(typeof(T), out obj, key); if (result && obj is T) { value = (T)obj; return(true); } value = default(T); return(result); }
public static bool TryGet <T>(this IProcessorContext context, out T value) { return(context.TryGet(out value, ProcessorContextKeys.Default)); }