RandomAccess 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供基于偏移量的 API,用于以线程安全的方式读取和写入文件。
public ref class RandomAccess abstract sealed
	public static class RandomAccess
	type RandomAccess = class
	Public Class RandomAccess
		- 继承
 - 
				RandomAccess
 
注解
仅支持常规磁盘文件。 不支持不可查看的文件(如管道)。
方法
| FlushToDisk(SafeFileHandle) | 
		 将给定文件的操作系统缓冲区刷新到磁盘。  | 
        	
| GetLength(SafeFileHandle) | 
		 获取文件的长度(以字节为单位)。  | 
        	
| Read(SafeFileHandle, IReadOnlyList<Memory<Byte>>, Int64) | 
		 以给定偏移量从给定文件中读取字节序列。  | 
        	
| Read(SafeFileHandle, Span<Byte>, Int64) | 
		 以给定偏移量从给定文件中读取字节序列。  | 
        	
| ReadAsync(SafeFileHandle, IReadOnlyList<Memory<Byte>>, Int64, CancellationToken) | 
		 以给定偏移量从给定文件中读取字节序列。  | 
        	
| ReadAsync(SafeFileHandle, Memory<Byte>, Int64, CancellationToken) | 
		 以给定偏移量从给定文件中读取字节序列。  | 
        	
| SetLength(SafeFileHandle, Int64) | 
		 将文件的长度设置为给定值。  | 
        	
| Write(SafeFileHandle, IReadOnlyList<ReadOnlyMemory<Byte>>, Int64) | 
		 将给定缓冲区中的字节序列写入给定偏移量的给定文件。  | 
        	
| Write(SafeFileHandle, ReadOnlySpan<Byte>, Int64) | 
		 将给定缓冲区中的字节序列写入给定偏移量的给定文件。  | 
        	
| WriteAsync(SafeFileHandle, IReadOnlyList<ReadOnlyMemory<Byte>>, Int64, CancellationToken) | 
		 将给定缓冲区中的字节序列写入给定偏移量的给定文件。  | 
        	
| WriteAsync(SafeFileHandle, ReadOnlyMemory<Byte>, Int64, CancellationToken) | 
		 将给定缓冲区中的字节序列写入给定偏移量的给定文件。  |