/// <summary>
        /// 指定の<see cref="StringCasePattern"/>を文字列に変換します。
        /// </summary>
        /// <param name="value">変換する値</param>
        /// <returns>変換した値</returns>
        public string ConvertTo(StringCasePattern value)
        {
            string result;

            if (_names.TryGetValue(value, out result))
            {
                return(result);
            }
            else
            {
                throw new InvalidOperationException($"This item [{value}] is not supported");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 複合の単語を指定のパターンで連結するコンバーターを取得します。
        /// </summary>
        private static ICaseConverter GetConverter(StringCasePattern pattern)
        {
            ICaseConverter converter;

            if (_caseConverters.TryGetValue(pattern, out converter) && converter != null)
            {
                return(converter);
            }
            else
            {
                throw new InvalidOperationException($"This pattern [{pattern}]is not supported.");
            }
        }