FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System.IO; using System.Text; namespace Microsoft.ClearScript { /// /// Provides an in-memory implementation for a text document. /// public class StringDocument : Document { private readonly byte[] contents; /// /// Initializes a new instance. /// /// A structure containing meta-information for the document. /// A string containing the document's contents. public StringDocument(DocumentInfo info, string contents) { Info = info; this.contents = Encoding.UTF8.GetBytes(contents); } #region Document overrides /// /// Gets a structure containing meta-information for the document. /// public override DocumentInfo Info { get; } /// /// Gets a stream that provides read access to the document. /// /// /// The implementation of this property returns a /// instance. /// public override Stream Contents => new MemoryStream(contents, false); /// /// Gets the document's character encoding. /// /// /// instances return for this property. /// public override Encoding Encoding => Encoding.UTF8; #endregion } }

Back | FazBrowse Home | New Git URL