-
Notifications
You must be signed in to change notification settings - Fork 33
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
Extension methods for make serializing easier #338
Comments
Hi @svrooij I'm guessing we'd want the following: IParsable myModel = new();
await myModel.SerializeAsync("mediaType", stream);
var result = await myModel.SerializeAsStringAsync("mediaType");
await myModel.SerializeToJsonAsync(stream);
var result = await myModel.SerializeToJsonAsStringAsync(); This should work for To avoid any confusion, it should be in a sub-namespace. In terms of parameters, here is what the method with the most parameters would look like, everything else will be a subset. public static async Task SerializeAsync<T>(this T parsable, string meditaType, Stream targetStream, bool serializeOnlyChangedValues = false, CancellationToken cancellationToken = default) where T : IParsable {
//
} Did I miss anything? Also CC @andrueastman |
I'm not sure about the other namespace, putting it in another namespace will make discovery harder. |
@baywet to allow discoverability I'm suggesting the following, what do you think:
But I would suggest to add the extension methods to the dedicated project. That means you won't have a |
Something like this?
??? |
Fixed Extension methods for make serializing easier microsoft#338
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
Create extension methods to make serializing easier discoverable, as suggested by @baywet
They have been removed from the PR, in this commit. Feel free to re-use svrooij@a4a03d8
Originally posted by @baywet in #311 (comment)
The text was updated successfully, but these errors were encountered: