Based on your previous thread, I think you are using InstagramApiSharp.
We can see from its source code that LoadStateDataFromString will directly call the SerializationHelper.DeserializeFromString method, while LoadStateDataFromStream will go through some judgments and then call DeserializeFromString under certain conditions.
In view of the other possibilities preset by the author in the LoadStateDataFromStream method, and what you get now is a Stream, I recommend using LoadStateDataFromStream.
public void LoadStateDataFromStream(Stream stream)
{
var data = SerializationHelper.DeserializeFromStream<StateData>(stream);
LoadStateDataFromObject(data);
}
/// <summary>
/// Set state data from provided json string
/// </summary>
public void LoadStateDataFromString(string json)
{
var data = SerializationHelper.DeserializeFromString<StateData>(json);
LoadStateDataFromObject(data);
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.