I have a code in PHp that I am trying to redo in C #. PHP code has something like fputs ($ file, serialize ($ val))
What could be the NET point, namely the C # equivalent for Serialize ???
using (Stream stream = File.Open(filePath, FileMode.Create)) { BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Serialize(stream, myObject); }
As with most cases in .NET, there are many ways to get there, depending on how you plan to use it.
Ways I can think of in .NET BCL:
WCF DataContract Serializer, XML, JSON , (.NET 3.5 SP1 +), . : http://will.hughesfamily.net.au/20090309/net-35-helper-methods-serialize-objects-to-xml/
.NET provides either binary or XML / SOAP serialization. See MSDN .
Source: https://habr.com/ru/post/1781676/More articles:updating multiple nodes in xml using xquery and xdmp: node -replace - xqueryDefault override img css - cssОтключение режима ландшафта непростительно? - androidDoes SWT StyledText have a height limit? - javaSQL query to remove duplicate rows from one table? - sqlПредотвращение угона в ZK - javaHow to join subqueries in PL / SQL? - sqlHibernate order for a specific state - hibernateASP.NET MVC dropdown on change to trigger postback without Javascript - javascriptCriteria use an aggregate function in order - javaAll Articles