Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IClosable.Close method

Applies to Windows and Windows Phone

Releases system resources that are exposed by a Windows Runtime object.

.NET:  This method appears as IDisposable.Dispose.

Syntax


void Close()

Parameters

This method has no parameters.

Remarks

Implement this method to release the exclusive system resources that are in use, such as file handles, streams, and network sockets. The method should also release other resources that are in use, including object references and memory, to prepare them for reuse.

This method must call the Close method of any object it holds that implements IClosable.

The Close method should release system resources as quickly as possible, without blocking for asynchronous operations to complete. To ensure that all resources are completely released, the caller must wait for all outstanding asynchronous operations to complete before calling Close.

After Close returns, the object is still in memory but without the system resources it needs; therefore, most of its members are not usable. A member that depends on a released system resource can return RO_E_CLOSED to indicate that the object is closed and it cannot complete the requested operation.

If you call Close multiple times, there is no effect; the method returns S_OK.

Close methods aren't callable through Visual C++ component extensions (C++/CX) on Windows Runtime class instances where the class implemented IClosable. Instead, C++/CX code for runtime classes should call the destructor or set the last reference to null.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows::Foundation

Metadata

Windows.winmd

See also

IClosable

 

 

Show:
© 2014 Microsoft