DynamicRest.JsonWriter.StartScope C# (CSharp) Method

StartScope() private method

private StartScope ( ScopeType type ) : void
type ScopeType
return void
        private void StartScope(ScopeType type)
        {
            if (_scopes.Count != 0) {
                Scope currentScope = _scopes.Peek();
                if ((currentScope.Type == ScopeType.Array) &&
                    (currentScope.ObjectCount != 0)) {
                    _writer.WriteTrimmed(", ");
                }

                currentScope.ObjectCount++;
            }

            Scope scope = new Scope(type);
            _scopes.Push(scope);

            if (type == ScopeType.Array) {
                _writer.Write("[");
            }
            else {
                _writer.Write("{");
            }
            _writer.Indent++;
            _writer.WriteLine();
        }