UnmanagedMemoryStream.Initialize 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在安全缓冲区中或使用指向非托管内存位置的指针初始化 UnmanagedMemoryStream 类的新实例。
Initialize(Byte*, Int64, Int64, FileAccess) |
使用指向非托管内存位置的指针初始化 UnmanagedMemoryStream 类的新实例。 |
Initialize(SafeBuffer, Int64, Int64, FileAccess) |
在具有指定的偏移量、长度和文件访问的安全缓冲区中初始化 UnmanagedMemoryStream 类的新实例。 |
- Source:
- UnmanagedMemoryStream.cs
- Source:
- UnmanagedMemoryStream.cs
- Source:
- UnmanagedMemoryStream.cs
重要
此 API 不符合 CLS。
使用指向非托管内存位置的指针初始化 UnmanagedMemoryStream 类的新实例。
protected:
void Initialize(System::Byte* pointer, long length, long capacity, System::IO::FileAccess access);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
protected void Initialize (byte* pointer, long length, long capacity, System.IO.FileAccess access);
[System.CLSCompliant(false)]
protected void Initialize (byte* pointer, long length, long capacity, System.IO.FileAccess access);
protected void Initialize (byte* pointer, long length, long capacity, System.IO.FileAccess access);
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
member this.Initialize : nativeptr<byte> * int64 * int64 * System.IO.FileAccess -> unit
[<System.CLSCompliant(false)>]
member this.Initialize : nativeptr<byte> * int64 * int64 * System.IO.FileAccess -> unit
member this.Initialize : nativeptr<byte> * int64 * int64 * System.IO.FileAccess -> unit
参数
- pointer
- Byte*
指向非托管内存位置的指针。
- length
- Int64
要使用的内存的长度。
- capacity
- Int64
分配给流的内存总量。
- access
- FileAccess
FileAccess 值之一。
- 属性
例外
用户没有所必需的权限。
pointer
值为 null
。
注解
此方法等效于 UnmanagedMemoryStream 构造函数。 它支持在设置流变量之前需要初始化指针的方法,因此无法调用参数化构造函数。 此类方法应使用无参数构造函数 UnmanagedMemoryStream(),初始化指针,然后调用 Initialize 方法。
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
- Source:
- UnmanagedMemoryStream.cs
- Source:
- UnmanagedMemoryStream.cs
- Source:
- UnmanagedMemoryStream.cs
在具有指定的偏移量、长度和文件访问的安全缓冲区中初始化 UnmanagedMemoryStream 类的新实例。
protected:
void Initialize(System::Runtime::InteropServices::SafeBuffer ^ buffer, long offset, long length, System::IO::FileAccess access);
protected void Initialize (System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length, System.IO.FileAccess access);
member this.Initialize : System.Runtime.InteropServices.SafeBuffer * int64 * int64 * System.IO.FileAccess -> unit
Protected Sub Initialize (buffer As SafeBuffer, offset As Long, length As Long, access As FileAccess)
参数
- buffer
- SafeBuffer
要包含非托管内存流的缓冲区。
- offset
- Int64
启动非托管内存流的缓冲区字节位置。
- length
- Int64
非托管内存流的长度。
- access
- FileAccess
非托管内存流的文件访问模式。
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |