NuGet.StreamExtensions.ToStreamFactory C# (CSharp) Méthode

ToStreamFactory() public static méthode

Turns an existing stream into one that a stream factory that can be reopened.
public static ToStreamFactory ( this stream ) : Func
stream this
Résultat Func
        public static Func<Stream> ToStreamFactory(this Stream stream)
        {
            byte[] buffer;

            using (var ms = new MemoryStream())
            {
                stream.CopyTo(ms);
                buffer = ms.ToArray();
            }

            return () => new MemoryStream(buffer);
        }