Exemple #1
0
        public KnobValue GetValue(IKnobValueContext context)
        {
            ArgUtil.NotNull(context, nameof(context));
            var value = context.GetVariableValueOrDefault(_runTimeVar);

            if (!string.IsNullOrEmpty(value))
            {
                return(new KnobValue(value, this));
            }
            return(null);
        }
        public KnobValue GetValue(IKnobValueContext context)
        {
            ArgUtil.NotNull(context, nameof(context));
            string value = null;

            try
            {
                value = context.GetVariableValueOrDefault(_runTimeVar);
            }
            catch (NotSupportedException)
            {
                throw new NotSupportedException($"{nameof(RuntimeKnobSource)} not supported for context type {context.GetType()}");
            }

            if (!string.IsNullOrEmpty(value))
            {
                return(new KnobValue(value, this));
            }
            return(null);
        }