62 references to EnclosingContainerType
System.Text.Json (62)
System\Text\Json\ThrowHelper.cs (6)
317public static void ThrowInvalidOperationException_CannotMixEncodings(EnclosingContainerType previousEncoding, EnclosingContainerType currentEncoding) 321static string GetEncodingName(EnclosingContainerType encoding) 325case EnclosingContainerType.Utf8StringSequence: return "UTF-8"; 326case EnclosingContainerType.Utf16StringSequence: return "UTF-16"; 327case EnclosingContainerType.Base64StringSequence: return "Base64";
System\Text\Json\Writer\Utf8JsonWriter.cs (14)
44private EnclosingContainerType _enclosingContainer; 125Debug.Assert(_enclosingContainer == EnclosingContainerType.Utf8StringSequence); 154Debug.Assert(_enclosingContainer == EnclosingContainerType.Utf16StringSequence); 182Debug.Assert(_enclosingContainer == EnclosingContainerType.Base64StringSequence); 653if (_enclosingContainer == EnclosingContainerType.Object) 1079if (_enclosingContainer != EnclosingContainerType.Array) 1088if (_enclosingContainer != EnclosingContainerType.Object) 1094EnclosingContainerType container = _bitStack.Pop() ? EnclosingContainerType.Object : EnclosingContainerType.Array; 1095_enclosingContainer = _bitStack.CurrentDepth == 0 ? EnclosingContainerType.None : container; 1161_enclosingContainer = EnclosingContainerType.Array; 1167_enclosingContainer = EnclosingContainerType.Object; 1264private bool IsWritingPartialString => _enclosingContainer >= EnclosingContainerType.Utf8StringSequence;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Helpers.cs (3)
40if (_enclosingContainer != EnclosingContainerType.Object || _tokenType == JsonTokenType.PropertyName) 53if (_enclosingContainer != EnclosingContainerType.Object || _tokenType == JsonTokenType.PropertyName) 71Debug.Assert(_enclosingContainer != EnclosingContainerType.Object || _tokenType == JsonTokenType.PropertyName);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Helpers.cs (15)
19/// <see cref="EnclosingContainerType.Array"/>: Writing a value is always allowed. 22/// <see cref="EnclosingContainerType.Object"/>: Writing a value is allowed only if <see cref="_tokenType"/> is a property name. 23/// Because we designed <see cref="EnclosingContainerType.Object"/> == <see cref="JsonTokenType.PropertyName"/>, we can just check for equality. 26/// <see cref="EnclosingContainerType.None"/>: Writing a value is allowed only if <see cref="_tokenType"/> is None (only one value may be written at the root). 30/// <see cref="EnclosingContainerType.Utf8StringSequence"/>, <see cref="EnclosingContainerType.Utf16StringSequence"/>, <see cref="EnclosingContainerType.Base64StringSequence"/>: 36private bool CanWriteValue => _enclosingContainer == EnclosingContainerType.Array | (byte)_enclosingContainer == (byte)_tokenType; 63if (_enclosingContainer == EnclosingContainerType.Object) 77private void ValidateWritingSegment(EnclosingContainerType currentSegmentEncoding) 79Debug.Assert(currentSegmentEncoding is EnclosingContainerType.Utf8StringSequence or EnclosingContainerType.Utf16StringSequence or EnclosingContainerType.Base64StringSequence); 94private void OnValidateWritingSegmentFailed(EnclosingContainerType currentSegmentEncoding) 103if (_enclosingContainer == EnclosingContainerType.Object)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.StringSegment.cs (24)
33ValidateWritingSegment(EnclosingContainerType.Utf16StringSequence); 36if (_enclosingContainer != EnclosingContainerType.Utf16StringSequence) 39_enclosingContainer = EnclosingContainerType.Utf16StringSequence; 58EnclosingContainerType container = _bitStack.Peek() ? EnclosingContainerType.Object : EnclosingContainerType.Array; 59_enclosingContainer = _bitStack.CurrentDepth == 0 ? EnclosingContainerType.None : container; 67Debug.Assert(_enclosingContainer == EnclosingContainerType.Utf16StringSequence); 201ValidateWritingSegment(EnclosingContainerType.Utf8StringSequence); 204if (_enclosingContainer != EnclosingContainerType.Utf8StringSequence) 207_enclosingContainer = EnclosingContainerType.Utf8StringSequence; 226EnclosingContainerType container = _bitStack.Peek() ? EnclosingContainerType.Object : EnclosingContainerType.Array; 227_enclosingContainer = _bitStack.CurrentDepth == 0 ? EnclosingContainerType.None : container; 235Debug.Assert(_enclosingContainer == EnclosingContainerType.Utf8StringSequence); 368ValidateWritingSegment(EnclosingContainerType.Base64StringSequence); 371if (_enclosingContainer != EnclosingContainerType.Base64StringSequence) 374_enclosingContainer = EnclosingContainerType.Base64StringSequence; 393EnclosingContainerType container = _bitStack.Peek() ? EnclosingContainerType.Object : EnclosingContainerType.Array; 394_enclosingContainer = _bitStack.CurrentDepth == 0 ? EnclosingContainerType.None : container; 402Debug.Assert(_enclosingContainer == EnclosingContainerType.Base64StringSequence);