IBuffer Interface
Definition
public interface class IBuffer
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(2421821408, 48211, 4575, 140, 73, 0, 30, 79, 198, 134, 218)]
struct IBuffer
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(2421821408, 48211, 4575, 140, 73, 0, 30, 79, 198, 134, 218)]
public interface IBuffer
Public Interface IBuffer
- Derived
- Attributes
Windows 10 requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Examples
This code example shows how to retrieve a string from an IBuffer of UTF-8 bytes.
public string RetrieveStringFromUtf8IBuffer(Windows.Storage.Streams.IBuffer theBuffer)
{
using (var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(theBuffer))
{
dataReader.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8;
return dataReader.ReadString(theBuffer.Length);
}
}
Remarks
For more info, see Create, write, and read a file, which shows how to read and write bytes to a file by using a Buffer.
WriteableBitmap.PixelBuffer is an example of a property that returns an IBuffer that can't be written to directly. See that topic for a language-specific code example showing to write to the underlying pixel content in the buffer.
Properties
Capacity |
Gets the maximum number of bytes that the buffer can hold. |
Length |
Gets the number of bytes currently in use in the buffer. |