|
9 | 9 | [](https://github.com/tabrath/BinaryEncoding/fork) |
10 | 10 | [](https://github.com/tabrath/BinaryEncoding/star) |
11 | 11 | [](https://github.com/tabrath/BinaryEncoding/blob/master/LICENSE) |
12 | | - |
| 12 | + |
13 | 13 |  |
14 | 14 |
|
15 | 15 | BinaryEncoding simplifies the encoding of numbers to BigEndian, LittleEndian and Varint to byte arrays. |
16 | 16 |
|
17 | 17 | ## API |
18 | 18 |
|
19 | 19 | To set values to an array of bytes: |
20 | | -``` cs |
| 20 | + |
| 21 | +```cs |
21 | 22 | Binary.BigEndian.Set(bytes, offset, value); |
22 | 23 | Binary.LittleEndian.Set(bytes, offset, value); |
23 | 24 | Binary.Varint.Write(bytes, offset, value); |
24 | 25 | ``` |
25 | 26 |
|
26 | 27 | Extension methods are provided for retrieving the bytes: |
27 | | -``` cs |
| 28 | + |
| 29 | +```cs |
28 | 30 | Binary.BigEndian.GetBytes(value); |
29 | 31 | Binary.LittleEndian.GetBytes(value); |
30 | 32 | Binary.Varint.GetBytes(value); |
31 | 33 | ``` |
32 | 34 |
|
33 | 35 | Also, for converting bytes to numbers: |
34 | | -``` cs |
| 36 | + |
| 37 | +```cs |
35 | 38 | Binary.BigEndian.GetInt16(bytes, offset); |
36 | 39 | Binary.BigEndian.GetInt32(bytes, offset); |
37 | 40 | Binary.BigEndian.GetInt64(bytes, offset); |
|
0 commit comments