﻿// <copyright file="StreamExtensions.cs" company="KrossKode">
//     Copyright (c) KrossKode. All rights reserved.
//     Licensed under the MIT License. See LICENSE file in the project root for full license information. 
// </copyright>
// <author>Karlo E. Meléndez Peña</author>
namespace KK.Extensions
{
    using System.IO;

    /// <summary>
    /// Provides extension methods for <see cref="Stream"/>.
    /// </summary>
    public static class StreamExtensions
    {
        /// <summary>
        /// Reads the contents of a Stream to a string.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <returns>The string.</returns>
        public static string ReadToString(this Stream stream)
        {
            using (var reader = new StreamReader(stream))
            {
                return reader.ReadToEnd();
            }
        }
    }
}
