62 references to EnclosingContainerType
System.Text.Json (62)
System\Text\Json\ThrowHelper.cs (6)
317
public static void ThrowInvalidOperationException_CannotMixEncodings(
EnclosingContainerType
previousEncoding,
EnclosingContainerType
currentEncoding)
321
static string GetEncodingName(
EnclosingContainerType
encoding)
325
case
EnclosingContainerType
.Utf8StringSequence: return "UTF-8";
326
case
EnclosingContainerType
.Utf16StringSequence: return "UTF-16";
327
case
EnclosingContainerType
.Base64StringSequence: return "Base64";
System\Text\Json\Writer\Utf8JsonWriter.cs (14)
44
private
EnclosingContainerType
_enclosingContainer;
125
Debug.Assert(_enclosingContainer ==
EnclosingContainerType
.Utf8StringSequence);
154
Debug.Assert(_enclosingContainer ==
EnclosingContainerType
.Utf16StringSequence);
182
Debug.Assert(_enclosingContainer ==
EnclosingContainerType
.Base64StringSequence);
653
if (_enclosingContainer ==
EnclosingContainerType
.Object)
1079
if (_enclosingContainer !=
EnclosingContainerType
.Array)
1088
if (_enclosingContainer !=
EnclosingContainerType
.Object)
1094
EnclosingContainerType
container = _bitStack.Pop() ?
EnclosingContainerType
.Object :
EnclosingContainerType
.Array;
1095
_enclosingContainer = _bitStack.CurrentDepth == 0 ?
EnclosingContainerType
.None : container;
1161
_enclosingContainer =
EnclosingContainerType
.Array;
1167
_enclosingContainer =
EnclosingContainerType
.Object;
1264
private bool IsWritingPartialString => _enclosingContainer >=
EnclosingContainerType
.Utf8StringSequence;
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Helpers.cs (3)
40
if (_enclosingContainer !=
EnclosingContainerType
.Object || _tokenType == JsonTokenType.PropertyName)
53
if (_enclosingContainer !=
EnclosingContainerType
.Object || _tokenType == JsonTokenType.PropertyName)
71
Debug.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"/>:
36
private bool CanWriteValue => _enclosingContainer ==
EnclosingContainerType
.Array | (byte)_enclosingContainer == (byte)_tokenType;
63
if (_enclosingContainer ==
EnclosingContainerType
.Object)
77
private void ValidateWritingSegment(
EnclosingContainerType
currentSegmentEncoding)
79
Debug.Assert(currentSegmentEncoding is
EnclosingContainerType
.Utf8StringSequence or
EnclosingContainerType
.Utf16StringSequence or
EnclosingContainerType
.Base64StringSequence);
94
private void OnValidateWritingSegmentFailed(
EnclosingContainerType
currentSegmentEncoding)
103
if (_enclosingContainer ==
EnclosingContainerType
.Object)
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.StringSegment.cs (24)
33
ValidateWritingSegment(
EnclosingContainerType
.Utf16StringSequence);
36
if (_enclosingContainer !=
EnclosingContainerType
.Utf16StringSequence)
39
_enclosingContainer =
EnclosingContainerType
.Utf16StringSequence;
58
EnclosingContainerType
container = _bitStack.Peek() ?
EnclosingContainerType
.Object :
EnclosingContainerType
.Array;
59
_enclosingContainer = _bitStack.CurrentDepth == 0 ?
EnclosingContainerType
.None : container;
67
Debug.Assert(_enclosingContainer ==
EnclosingContainerType
.Utf16StringSequence);
201
ValidateWritingSegment(
EnclosingContainerType
.Utf8StringSequence);
204
if (_enclosingContainer !=
EnclosingContainerType
.Utf8StringSequence)
207
_enclosingContainer =
EnclosingContainerType
.Utf8StringSequence;
226
EnclosingContainerType
container = _bitStack.Peek() ?
EnclosingContainerType
.Object :
EnclosingContainerType
.Array;
227
_enclosingContainer = _bitStack.CurrentDepth == 0 ?
EnclosingContainerType
.None : container;
235
Debug.Assert(_enclosingContainer ==
EnclosingContainerType
.Utf8StringSequence);
368
ValidateWritingSegment(
EnclosingContainerType
.Base64StringSequence);
371
if (_enclosingContainer !=
EnclosingContainerType
.Base64StringSequence)
374
_enclosingContainer =
EnclosingContainerType
.Base64StringSequence;
393
EnclosingContainerType
container = _bitStack.Peek() ?
EnclosingContainerType
.Object :
EnclosingContainerType
.Array;
394
_enclosingContainer = _bitStack.CurrentDepth == 0 ?
EnclosingContainerType
.None : container;
402
Debug.Assert(_enclosingContainer ==
EnclosingContainerType
.Base64StringSequence);