N
N
Nikola242017-08-15 17:51:29
JSON
Nikola24, 2017-08-15 17:51:29

Can json parser implicitly cast jsonParse(string).ToObject() when parsed to descendants?

Can json parser implicitly cast jsonParse(string).ToObject<>() when parsing to heirs
if the abstract class from which everyone is inherited is known?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
diimahabr, 2017-08-24
@Nikola24

Here, after all, the parser is not engaged in casting. Here you need to ask if the language itself allows you to do this.
If you do something like children something = (children)jsonParse(string).ToObject<>(); then unpacking will occur and everything will be ok.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question