missing `IDeserializer object? Deserialize(string input)` method
FyiurAmron opened this issue · comments
Is your feature request related to a problem? Please describe.
Currently, there are matching pairs of methods on this interface, but one combination is missing:
T Deserialize<T>(string input);
T Deserialize<T>(TextReader input);
T Deserialize<T>(IParser parser);
// no object? Deserialize(string input); here :(
object? Deserialize(TextReader input);
object? Deserialize(IParser parser);
object? Deserialize(string input, Type type);
object? Deserialize(TextReader input, Type type);
object? Deserialize(IParser parser, Type type); // the "real" method, i.e. the one that the others call in impl
It makes it impossible to call the deserializer this way.
Describe the solution you'd like
Add the missing interface method and implementation. See below for an example implementation for Deserializer
class.
Describe alternatives you've considered
static class Extensions {
public static object? Deserialize(this IDeserializer iSerializer, string input)
{
using (StringReader input1 = new StringReader(input))
return iSerializer.Deserialize((TextReader) input1);
}
}
or similar (in new .NET/C# versions, the body it can be even as simple as
using StringReader input1 = new(input);
return iSerializer.Deserialize(input1);
)
Additional context
In case of "sure, but no manpower, PR welcome", I can gladly do a PR for this as soon as I have some spare time, since it's trivial :D
A pr would be very much appreciated. Please be sure to add it to the staticdeserializer as well.
@EdwardCooke sorry if I'm being dumb here, but can you elaborate on the
Please be sure to add it to the staticdeserializer as well.
part? I've went through StaticDeserializerBuilder
(and also StaticSerializerBuilder
) and honestly don't know where (and if, TBH) anything should be put there alongside the main change. I mean, those missing methods are just helper methods, the core functionality remains unchanged, and I don't see those kind of helpers as applicable to the StaticXyzBuilder
classes (or even present in them ATM). They invoke only the "main" c-tor on Build()
calls anyway (which is untampered).