我有一些 PHP 代码,我想用 C# 重做。 PHP 代码有类似 fputs($file,serialize($val))
什么是点 NET,特别是 C# 等同于序列化???
最佳答案
using (Stream stream = File.Open(filePath, FileMode.Create))
{
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Serialize(stream, myObject);
}
关于c# - PHP 序列化的 C# 等价物是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4510630/