Skip to content

Commit f21d3ec

Browse files
Copilotpetesramek
andauthored
docs: update README examples to use PolylineValueState state fields
Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/7920fca6-3575-456d-9604-4e1400a5a5eb Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com>
1 parent 9988339 commit f21d3ec

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/PolylineAlgorithm/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ using PolylineAlgorithm.Abstraction;
4141
using PolylineAlgorithm.Internal;
4242

4343
public sealed class MyPolylineEncoder : AbstractPolylineEncoder<(double Latitude, double Longitude), string> {
44+
private PolylineValueState _latitudeState;
45+
private PolylineValueState _longitudeState;
46+
4447
protected override void Write((double Latitude, double Longitude) item, ref PolylineWriter writer) {
45-
writer.Write(item.Latitude); // field 0
46-
writer.Write(item.Longitude); // field 1
48+
writer.Write(item.Latitude, ref _latitudeState); // field 0
49+
writer.Write(item.Longitude, ref _longitudeState); // field 1
4750
}
4851
protected override string CreatePolyline(ReadOnlySpan<char> polyline) => polyline.ToString();
4952
}
@@ -75,8 +78,11 @@ using PolylineAlgorithm.Abstraction;
7578
using PolylineAlgorithm.Internal;
7679

7780
public sealed class MyPolylineDecoder : AbstractPolylineDecoder<string, (double Latitude, double Longitude)> {
81+
private PolylineValueState _latitudeState;
82+
private PolylineValueState _longitudeState;
83+
7884
protected override (double Latitude, double Longitude) Read(PolylineReader reader) =>
79-
(reader.Read(), reader.Read()); // field 0, field 1
85+
(reader.Read(ref _latitudeState), reader.Read(ref _longitudeState)); // field 0, field 1
8086
protected override ReadOnlyMemory<char> GetReadOnlyMemory(in string polyline) => polyline.AsMemory();
8187
}
8288
```

0 commit comments

Comments
 (0)