Is this an example of binary serialization

Posted by Ray.chayan under C# on 8/22/2010 | Points: 10 | Views : 2275 | Status : [Member] | Replies : 1
Hi , I have write this code for write error message in .txt file and this code is working fine.
void writeToLogFile(string logMessage)
{
string strLogMessage = string.Empty;
string strLogFile = System.Configuration.ConfigurationManager.AppSettings["logFilePath"].ToString();
StreamWriter swLog;

strLogMessage = string.Format("{0}: {1}", DateTime.Now, logMessage);

if (!File.Exists(strLogFile))
{
swLog = new StreamWriter(strLogFile);
}
else
{
swLog = File.AppendText(strLogFile);
}

swLog.WriteLine(strLogMessage);
swLog.WriteLine();

swLog.Close();

}



I want to know is this an example of binary serialization?
If YES then please inform me from which line the serialization is done?
If NO then please tell me an example of Binary Serialization ?




Responses

Posted by: SheoNarayan on: 8/22/2010 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Not sure why you need binary serialization

However to understand how Binary serialization is done, read below articles

http://www.dotnetfunda.com/articles/article622-demonstration-of-serialization-in-vbnet-.aspx (Vb.net code, change to C#)
http://www.dotnetfunda.com/codes/code323-binary-serialize-a-custom-object-in-csharp-.aspx

To read and write text files, use below article
http://www.dotnetfunda.com/articles/article462-different-ways-of-reading-and-writing-text-file-data-in-net.aspx

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Ray.chayan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response