Class SpanReader
Represents extension methods for SpanReader<T> type.
Inherited Members
Namespace: DotNext.Buffers
Assembly: DotNext.dll
Syntax
public static class SpanReader
Methods
| Improve this Doc View SourceRead<T>(ref SpanReader<Byte>)
Reads the value of blittable type from the raw bytes represents by memory block.
Declaration
public static T Read<T>(this ref SpanReader<byte> reader)
where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| SpanReader<Byte> | reader | The memory reader. |
Returns
| Type | Description |
|---|---|
| T | The value deserialized from bytes. |
Type Parameters
| Name | Description |
|---|---|
| T | The blittable type. |
Exceptions
| Type | Condition |
|---|---|
| EndOfStreamException | The end of memory block is reached. |
TryRead<T>(ref SpanReader<Byte>, out T)
Reads the value of blittable type from the raw bytes represents by memory block.
Declaration
public static bool TryRead<T>(this ref SpanReader<byte> reader, out T result)
where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| SpanReader<Byte> | reader | The memory reader. |
| T | result | The value deserialized from bytes. |
Returns
| Type | Description |
|---|---|
| Boolean | true if memory block contains enough amount of unread bytes to decode the value; otherwise, false. |
Type Parameters
| Name | Description |
|---|---|
| T | The blittable type. |