Ejemplo n.º 1
0
        /// <summary>
        /// Strings as literal.
        /// </summary>
        /// <param name="theString">The string.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public static string StringAsLiteral(string theString)
        {
            var expression = new CodePrimitiveExpression(theString);
            var sb         = new StringBuilder();
            var options    = new CodeGeneratorOptions();

            using (TextWriter writer = new StringWriter(sb))
            {
                _provider.GenerateCodeFromExpression(expression, writer, options);
            }
            return("(" + sb + ")");
        }