Pickle in c#

What is the c# (dotnet) alternative of python’s pickle?

There are a lot of ways of do that. But note that in .net doesn’t have sense to serialize a method bc it is not a dynamic language, or something like that I just read.

1 Like

After I created the thread I remembered using MemoryStream in the past, could that be saved to file and used similarly to pickle? Or is it better to directly move to database instead of using serialization to file?

You are doing serialization if you move it to a file.

If you need to save data to a file, use FileStream instead.

1 Like

Is it more optimized or?
I’ll read about it, thanks.


Peter Ritchie says:
“MemoryStream performs i/o to memory, FileStream to a file. They’re not really interchangable. From a performance standpoint, read/writing to memory is always going to be faster than read/writing to disk.”

Use this example:

1 Like

Thanks @Dani_Abalde