MifareClassic.ReadBlockAsync(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads a 16-byte block from the tag on a thread-pool thread.
public System.Threading.Tasks.Task<byte[]?> ReadBlockAsync(int blockIndex);
member this.ReadBlockAsync : int -> System.Threading.Tasks.Task<byte[]>
Parameters
- blockIndex
- Int32
The zero-based index of the block to read, from 0 through 255. The block must be available on the tag.
Returns
A task whose result contains the 16 bytes read from the block.
Remarks
This managed wrapper uses Task.Run to call ReadBlock(Int32). Connect and authenticate the block's sector first. Await the task before starting another operation.
The synchronous method's connection, access, and NFC permission requirements apply. The method has no cancellation-token parameter. Calling Close() from another thread cancels blocked I/O with IOException. Exceptions from the synchronous call are reported through the task.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.