Click here to Skip to main content
16,012,028 members
Home / Discussions / C#
   

C#

 
AnswerRe: CD Product Key Pin
Guffa10-Oct-06 13:09
Guffa10-Oct-06 13:09 
GeneralRe: CD Product Key Pin
picasso210-Oct-06 17:59
picasso210-Oct-06 17:59 
QuestionUsing float.Parse(string) and language problems ! Pin
pe_chaut10-Oct-06 12:01
pe_chaut10-Oct-06 12:01 
AnswerRe: Using float.Parse(string) and language problems ! Pin
Guffa10-Oct-06 13:12
Guffa10-Oct-06 13:12 
QuestionSending commercial SMS Pin
Goalie3510-Oct-06 9:42
Goalie3510-Oct-06 9:42 
QuestionSensible way to scale and display large 1 bit Tiff G4!! Pin
abcxyz8210-Oct-06 8:36
abcxyz8210-Oct-06 8:36 
Questionplease HELLPPPP... Pin
nedimg10-Oct-06 8:16
nedimg10-Oct-06 8:16 
AnswerRe: please HELLPPPP... Pin
mikone10-Oct-06 9:40
mikone10-Oct-06 9:40 
Hi,

add this using statement to your code:
<br />
using System.Runtime.Serialization.Formatters.Binary;<br />


use this code to read the file:
<br />
MyClass MyObject = null;<br />
BinaryFormatter binReader = new BinaryFormatter();<br />
System.IO.Stream readStream = File.Open("c:\blah.dat", FileMode.Open);<br />
MyObject = (MyClass)binReader.Deserialize(readStream);<br />
readStream.Close();<br />


and this one to write it:
<br />
MyClass MyObject = new MyClass();<br />
<br />
BinaryFormatter binWriter = new BinaryFormatter();<br />
System.IO.Stream writeStream = File.Open("c:\blah.dat", FileMode.Create);<br />
binWriter.Serialize(writeStream, MyObject);<br />
writeStream.Close();<br />


and this is the class (or struct) you want to write to a file...
<br />
[Serializable]<br />
public class MyClass<br />
{<br />
string SomeString = null;<br />
int SomeInteger = 0;<br />
string AnotherString = null;<br />
}<br />

QuestionError Pin
messages10-Oct-06 8:14
messages10-Oct-06 8:14 
AnswerRe: How do i make one o' these? (pic inside) Pin
Guffa10-Oct-06 11:28
Guffa10-Oct-06 11:28 
GeneralRe: How do i make one o' these? (pic inside) Pin
Anthony Mushrow10-Oct-06 13:18
professionalAnthony Mushrow10-Oct-06 13:18 
GeneralRe: How do i make one o' these? (pic inside) Pin
Dan Neely11-Oct-06 2:16
Dan Neely11-Oct-06 2:16 
QuestionDropdown list Pin
Naji.A10-Oct-06 7:37
Naji.A10-Oct-06 7:37 
AnswerRe: Dropdown list Pin
Private_Void10-Oct-06 8:14
Private_Void10-Oct-06 8:14 
GeneralRe: Dropdown list Pin
Naji.A10-Oct-06 8:52
Naji.A10-Oct-06 8:52 
AnswerRe: Dropdown list Pin
Anthony Mushrow10-Oct-06 14:42
professionalAnthony Mushrow10-Oct-06 14:42 
GeneralRe: Dropdown list Pin
Private_Void11-Oct-06 3:10
Private_Void11-Oct-06 3:10 
Questional command line syntax Pin
waheed awan10-Oct-06 6:56
waheed awan10-Oct-06 6:56 
Questionexecuting a PHP file on the webserver [modified] Pin
asamay10-Oct-06 6:42
asamay10-Oct-06 6:42 
AnswerRe: executing an PHP file on the webserver Pin
mikone10-Oct-06 6:51
mikone10-Oct-06 6:51 
GeneralRe: executing a PHP file on the webserver Pin
asamay10-Oct-06 7:00
asamay10-Oct-06 7:00 
GeneralRe: executing a PHP file on the webserver Pin
mikone10-Oct-06 7:59
mikone10-Oct-06 7:59 
GeneralRe: executing a PHP file on the webserver Pin
asamay10-Oct-06 8:28
asamay10-Oct-06 8:28 
QuestionDataColumn and DataTable Pin
123456uio10-Oct-06 6:25
123456uio10-Oct-06 6:25 
AnswerRe: DataColumn and DataTable Pin
Ioan Anton10-Oct-06 8:19
Ioan Anton10-Oct-06 8:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.