Sdl.Web.Common/Models/StaticContentItem.cs
/// <summary>
/// Gets the content as text.
/// </summary>
/// <returns>The content as text.</returns>
/// <remarks>This method automatically disposes the underlying content Stream and can hence only be invoked once.</remarks>
Gets the content as text.
Gets the content as text .
public string GetText()
        {
            if (_contentStream == null)
            {
                throw new ObjectDisposedException("Content Stream has already been disposed. Cannot invoke StaticContentItem.GetText() more than once.");
            }
            if (TextEncoding == null)
            {
                throw new DxaException("Cannot invoke StaticContentItem.GetText() because the item has no Text Encoding.");
            }
            using (StreamReader streamReader = new StreamReader(_contentStream, TextEncoding))
            {
                string result = streamReader.ReadToEnd(); 
                _contentStream.Dispose();
                _contentStream = null;
                return result;
            }
        }
public string GetText ( ) { if ( _contentStream == null ) { throw new ObjectDisposedException ( " " ) ; } if ( TextEncoding == null ) { throw new DxaException ( " " ) ; } using ( StreamReader streamReader = new StreamReader ( _contentStream , TextEncoding ) ) { string result = streamReader . ReadToEnd ( ) ; _contentStream . Dispose ( ) ; _contentStream = null ; return result ; } }
Gets the content as text.
Gets the content as text .
The content as text.
The content as text .
remarks
This method automatically disposes the underlying content Stream and can hence only be invoked once.
This method automatically disposes the underlying content Stream and can hence only be invoked once .