Newtonsoft.Json.JsonTextReader.Close C# (CSharp) Method

Close() public method

Changes the reader's state to JsonReader.State.Closed.
public Close ( ) : void
return void
        public override void Close()
        {
            base.Close();

            if (_chars != null)
            {
                BufferUtils.ReturnBuffer(_arrayPool, _chars);
                _chars = null;
            }

            if (CloseInput && _reader != null)
            {
#if !(DOTNET || PORTABLE40 || PORTABLE)
                _reader.Close();
#else
                _reader.Dispose();
#endif
            }

            _stringBuffer.Clear(_arrayPool);
        }

Usage Example

Esempio n. 1
0
 private static string NewtonsoftDecode(string input)
 {
     var sr = new StringReader(input);
     var reader = new JsonTextReader(sr);
     var output = reader.ReadAsString();
     reader.Close();
     return output;
 }
All Usage Examples Of Newtonsoft.Json.JsonTextReader::Close