Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async APIs #48

Open
bdovaz opened this issue Jun 12, 2020 · 0 comments
Open

Async APIs #48

bdovaz opened this issue Jun 12, 2020 · 0 comments

Comments

@bdovaz
Copy link

bdovaz commented Jun 12, 2020

Please, can you add async APIs for serialization/deserialization?

For now I have solved it myself inheriting from the class for my specific case:

public class Gpx11SerializerAsync : Gpx11Serializer {

        public async Task<GpsData> DeserializeAsync(Stream stream) {
            using (var streamReader = new StreamReader(stream)) {
                var data = await streamReader.ReadToEndAsync();
                var xmlSerializer = new XmlSerializer(typeof(GpxFile));

                using (var stringReader = new StringReader(data)) {
                    var doc = (GpxFile)xmlSerializer.Deserialize(stringReader);
                    return DeSerialize(doc);
                }
            }
        }

    }

It would be nice if it worked in all cases through GpsData:

https://github.com/sibartlett/Geo/blob/master/Geo/Gps/GpsData.cs#L73

Something like:

public static async Task<GpsData> ParseAsync(Stream stream);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant