public void CreateAndNavigateCosmosElement( Payload payload, SerializationFormat jsonSerializationFormat, AccessPattern accessMode) { ReadOnlyMemory <byte> bytes = jsonSerializationFormat switch { SerializationFormat.Text => payload.Text, SerializationFormat.Binary => payload.Binary, _ => throw new ArgumentOutOfRangeException(nameof(jsonSerializationFormat)), }; for (int i = 0; i < 1; i++) { CosmosElement element = CosmosElement.CreateFromBuffer(bytes); int numAccessIterations = accessMode switch { AccessPattern.Never => 0, AccessPattern.Once => 1, AccessPattern.Many => 10, _ => throw new ArgumentOutOfRangeException(nameof(accessMode)), }; for (int accessIteration = 0; accessIteration < numAccessIterations; accessIteration++) { Access(element); } } }
public override string ToString() { if (!IsSM51) { return(string.Format("{0} {1}, {2}", TypeDescription, Operand.ToString().ToUpper(), AccessPattern.GetDescription())); } else { return(string.Format("{0} {1}[{2}], {3}, space={4}", TypeDescription, Operand.ToString().ToUpper(), m_ConstantBufferSize, AccessPattern.GetDescription(), SpaceIndex)); } }