当前位置: 首页>>代码示例>>C#>>正文


C# ObjectDisplayOptions.IncludesOption方法代码示例

本文整理汇总了C#中ObjectDisplayOptions.IncludesOption方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectDisplayOptions.IncludesOption方法的具体用法?C# ObjectDisplayOptions.IncludesOption怎么用?C# ObjectDisplayOptions.IncludesOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectDisplayOptions的用法示例。


在下文中一共展示了ObjectDisplayOptions.IncludesOption方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FormatLiteral

 internal static string FormatLiteral(short value, ObjectDisplayOptions options)
 {
     if (options.IncludesOption(ObjectDisplayOptions.UseHexadecimalNumbers))
     {
         // Special Case: for sbyte and short, specifically, negatives are shown
         // with extra precision.
         return "0x" + (value >= 0 ? value.ToString("x4") : ((int)value).ToString("x8"));
     }
     else
     {
         return value.ToString(CultureInfo.InvariantCulture);
     }
 }
开发者ID:sebgod,项目名称:roslyn,代码行数:13,代码来源:ObjectDisplay.cs

示例2: FormatLiteral

        internal static string FormatLiteral(uint value, ObjectDisplayOptions options, CultureInfo cultureInfo = null)
        {
            var pooledBuilder = PooledStringBuilder.GetInstance();
            var sb = pooledBuilder.Builder;

            if (options.IncludesOption(ObjectDisplayOptions.UseHexadecimalNumbers))
            {
                sb.Append("0x");
                sb.Append(value.ToString("x8"));
            }
            else
            {
                sb.Append(value.ToString(GetFormatCulture(cultureInfo)));
            }

            if (options.IncludesOption(ObjectDisplayOptions.IncludeTypeSuffix))
            {
                sb.Append('U');
            }

            return pooledBuilder.ToStringAndFree();
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:22,代码来源:ObjectDisplay.cs

示例3: FormatString

 internal override string FormatString(string str, ObjectDisplayOptions options)
 {
     return ObjectDisplay.FormatString(str, useQuotes: options.IncludesOption(ObjectDisplayOptions.UseQuotes));
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:4,代码来源:CSharpFormatter.Values.cs

示例4: FormatLiteral

        /// <summary>
        /// Returns a C# string literal with the given value.
        /// </summary>
        /// <param name="value">The value that the resulting string literal should have.</param>
        /// <param name="options">Options used to customize formatting of an object value.</param>
        /// <returns>A string literal with the given value.</returns>
        /// <remarks>
        /// Escapes non-printable characters.
        /// </remarks>
        public static string FormatLiteral(string value, ObjectDisplayOptions options)
        {
            ValidateOptions(options);

            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            return FormatString(value, options.IncludesOption(ObjectDisplayOptions.UseQuotes) ? '"' : '\0', escapeNonPrintable: true);
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:20,代码来源:ObjectDisplay.cs

示例5: FormatLiteral

        internal static string FormatLiteral(float value, ObjectDisplayOptions options)
        {
            ValidateOptions(options);

            var result = value.ToString("R", CultureInfo.InvariantCulture);

            return options.IncludesOption(ObjectDisplayOptions.IncludeTypeSuffix) ? result + "F" : result;
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:8,代码来源:ObjectDisplay.cs

示例6: ValidateOptions

 private static void ValidateOptions(ObjectDisplayOptions options)
 {
     // These options are mutually exclusive in C# unless we're formatting a char...should not be passed otherwise...
     Debug.Assert(!(options.IncludesOption(ObjectDisplayOptions.UseQuotes) && options.IncludesOption(ObjectDisplayOptions.UseHexadecimalNumbers)));
 }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:5,代码来源:ObjectDisplay.cs

示例7: FormatString

 internal override string FormatString(string str, ObjectDisplayOptions options)
 {
     return ObjectDisplay.FormatString(str, quote: options.IncludesOption(ObjectDisplayOptions.UseQuotes) ? '"' : '\0', escapeNonPrintable: false);
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:4,代码来源:CSharpFormatter.Values.cs


注:本文中的ObjectDisplayOptions.IncludesOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。