Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Serialization and deserialization can only use the same class #84

Open
MuNet opened this issue Nov 10, 2022 · 0 comments
Open

Serialization and deserialization can only use the same class #84

MuNet opened this issue Nov 10, 2022 · 0 comments

Comments

@MuNet
Copy link

MuNet commented Nov 10, 2022

        private class LogBook
        {
            public long Id { get; set; }

            public string Name { get; set; }
        }

        private class LogEntry
        {
            public long Id { get; set; }

            public string Name { get; set; }
        }

The following code does not work, do you have any good suggestions?

         var log = new LogBook { Id = 1, Name = "abc" };
        var bytes = binaryConverter.Serialize(log);
       
        //error occurred
        var log2 = binaryConverter.Deserialize<LogEntry>(bytes);
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant