ReusableMemoryStream Class

Definition

Stores a reusable MemoryStream. The MemoryStream will only be stored for reuse if its Capacity does not exceed the maximumStreamCapacity used when constructing the ReusableMemoryStream.

public ref class ReusableMemoryStream : Microsoft::VisualStudio::Utilities::ReusableResourceStore<System::IO::MemoryStream ^, int>
[Windows::Foundation::Metadata::WebHostHidden]
class ReusableMemoryStream : Microsoft::VisualStudio::Utilities::ReusableResourceStore<System::IO::MemoryStream, int>
public class ReusableMemoryStream : Microsoft.VisualStudio.Utilities.ReusableResourceStore<System.IO.MemoryStream,int>
type ReusableMemoryStream = class
    inherit ReusableResourceStore<MemoryStream, int>
Public Class ReusableMemoryStream
Inherits ReusableResourceStore(Of MemoryStream, Integer)
Inheritance

Constructors

ReusableMemoryStream(Int32)

Constructs a new ReusableMemoryStream.

Methods

Acquire(TConstructorParameter)

Acquires a cached instance of the resource, or allocates a new instance if none are currently available.

(Inherited from ReusableResourceStore<TResource,TConstructorParameter>)
AcquireCore()

Gets access to the resource stored by this object, and removes the resource so that subsequent callers cannot be handed the same resource at the same time.

(Inherited from ReusableResourceStoreBase<TResource>)
Allocate(Int32)

Allocates memory for the number of streams in constructorParameter.

Allocate(TConstructorParameter)

Allocates a new instance of the resource when one is not available in the cache.

(Inherited from ReusableResourceStore<TResource,TConstructorParameter>)
CanReuse(TResource, TConstructorParameter)

Validates that an already-cached resource value is safe to reuse when Acquire is called.

(Inherited from ReusableResourceStore<TResource,TConstructorParameter>)
Cleanup(MemoryStream)

Sets the stream length to 0.

Cleanup(TResource)

Immediately before releasing an object, performs cleanup on that object. This might be necessary to clean up state stored in the object to prevent leaking memory.

(Inherited from ReusableResourceStoreBase<TResource>)

Applies to