/// <summary>
        /// Converts a <see cref="Stream"/> to a <see cref="NativeStream"/>.
        /// </summary>
        /// <remarks>
        /// If <see cref="stream"/> is already a <see cref="NativeStream"/>, it will be returned as is.
        /// Otherwise, a <see cref="NativeStreamWrapper"/> around it will be created.
        /// </remarks>
        /// <param name="stream">The stream.</param>
        /// <returns></returns>
        public static NativeStream ToNativeStream(this Stream stream)
        {
            var nativeStream = stream as NativeStream;
            if (nativeStream == null)
                nativeStream = new NativeStreamWrapper(stream);

            return nativeStream;
        }
Example #2
0
        public static NativeStream ToNativeStream(this Stream stream)
        {
            var nativeStream = stream as NativeStream;

            if (nativeStream == null)
            {
                nativeStream = new NativeStreamWrapper(stream);
            }

            return(nativeStream);
        }