コード例 #1
0
        internal FormatterExpression GetProfile(string profileName)
        {
            FormatterExpression expr = _formatterProfiles.GetOrAdd(profileName,
                                                                   name => new FormatterExpression(t => (IValueFormatter)_serviceCtor(t)));

            return(expr);
        }
コード例 #2
0
        public IFormatterExpression ForSourceType <TSource>()
        {
            var valueFormatter = new FormatterExpression(_formatterCtor);

            _typeSpecificFormatters[typeof(TSource)] = valueFormatter;

            return(valueFormatter);
        }
コード例 #3
0
        internal FormatterExpression GetProfile(string profileName)
        {
            FormatterExpression expr;

            if (!_formatterProfiles.TryGetValue(profileName, out expr))
            {
                lock (_formatterProfiles)
                {
                    if (!_formatterProfiles.TryGetValue(profileName, out expr))
                    {
                        expr = new FormatterExpression(t => (IValueFormatter)_serviceCtor(t));

                        _formatterProfiles.Add(profileName, expr);
                    }
                }
            }

            return(expr);
        }