示例#1
0
        bool TryInlineScalar(YamlScalar obj, int maximumWidth, [MaybeNullWhen(false)] out string result)
        {
            result = obj.ToString();
            if (result.Length > maximumWidth)
            {
                result = null;
            }

            return(result is not null);
        }
示例#2
0
        bool TryInlineScalar(YamlScalar obj, int maximumWidth, out string result)
        {
            result = obj.ToString();
            if (result.Length > maximumWidth)
            {
                result = null;
            }

            return(result != null);
        }
示例#3
0
 void WriteScalar(YamlScalar obj, bool allowInlining)
 {
     if (allowInlining && TryInlineScalar(obj, _maximumWidth - _indentColumn, out var inlined))
     {
         WriteInline(inlined);
     }
     else
     {
         Write(obj.ToString());
     }
 }