Click here to Skip to main content
15,921,646 members
Home / Discussions / C#
   

C#

 
AnswerRe: need project code Pin
Professor Sharada Ulhas22-Apr-07 7:56
Professor Sharada Ulhas22-Apr-07 7:56 
Questionhow to set "automatic dns" using wmi? Pin
Krzysztof Gorgolewski21-Apr-07 8:58
Krzysztof Gorgolewski21-Apr-07 8:58 
AnswerRe: how to set "automatic dns" using wmi? Pin
Dave Kreskowiak21-Apr-07 12:19
mveDave Kreskowiak21-Apr-07 12:19 
GeneralRe: how to set "automatic dns" using wmi? Pin
Krzysztof Gorgolewski22-Apr-07 23:12
Krzysztof Gorgolewski22-Apr-07 23:12 
AnswerRe: how to set "automatic dns" using wmi? Pin
Krzysztof Gorgolewski29-Apr-07 22:19
Krzysztof Gorgolewski29-Apr-07 22:19 
Questioncombo box and richtext help Pin
r_jaz21-Apr-07 5:37
r_jaz21-Apr-07 5:37 
AnswerRe: combo box and richtext help Pin
MoustafaS21-Apr-07 7:47
MoustafaS21-Apr-07 7:47 
AnswerRe: combo box and richtext help Pin
Keshav V. Kamat22-Apr-07 22:48
Keshav V. Kamat22-Apr-07 22:48 
GeneralRe: combo box and richtext help Pin
r_jaz23-Apr-07 1:42
r_jaz23-Apr-07 1:42 
QuestionAdd-in open designer Pin
thrakazog21-Apr-07 5:11
thrakazog21-Apr-07 5:11 
QuestionPath to application folder Pin
gammet21-Apr-07 4:07
gammet21-Apr-07 4:07 
AnswerRe: Path to application folder Pin
Stefan Troschuetz21-Apr-07 5:39
Stefan Troschuetz21-Apr-07 5:39 
GeneralRe: Path to application folder Pin
Bryan Ray21-Apr-07 17:22
Bryan Ray21-Apr-07 17:22 
AnswerRe: Path to application folder Pin
MSilviu21-Apr-07 18:59
MSilviu21-Apr-07 18:59 
GeneralRe: Path to application folder Pin
gammet22-Apr-07 21:33
gammet22-Apr-07 21:33 
QuestionSerialization problem Pin
NaNg1524121-Apr-07 3:06
NaNg1524121-Apr-07 3:06 
AnswerRe: Serialization problem Pin
mdv11321-Apr-07 9:53
mdv11321-Apr-07 9:53 
I don’t really understand what the problem is you are experiencing but I could tell you how I serialize into a binary stream I stream can be send or saved to file. Serializing to XML goes the same way. Note both serializer and deserializer and the object definition of the object to serialize should be the same at the sending and receiving end. To ensure this I simply put the classes in a dll which both sides use. With dotnet 1.x the formatter will give an exception when a version difference is detected. In dotnet 2.0 the formatter will serialize everything it recognizes even if there are version differences. The class to serialize should be declared with [Serializable]


///
/// Serialize object to byte array, object must be Serializable
///

/// <param name="someobject" />object to serialize
/// <returns>array
public byte[] Serialize(T someobject)
{
byte[] objectstream=null;
BinaryFormatter f = new BinaryFormatter();
MemoryStream stream = new MemoryStream();
f.Serialize(stream, someobject);
stream.SetLength( stream.Position);
objectstream = stream.GetBuffer();
return objectstream;
}
public void Deserialize(byte[] stream, out T someobject)
{
BinaryFormatter f = new BinaryFormatter();
MemoryStream serstream = new MemoryStream(stream);
someobject = (T)f.Deserialize(serstream);
}

Class def of class to serialize:

[Serializable]
public class SetConfigMessage
{
public string Name = "";
public string Value = "";
///
/// Config message
///

/// <param name="name" />
/// <param name="svalue" />
public SetConfigMessage() { }
public SetConfigMessage(string name, string value)
{
this.Name = name;
this.Value = value;
}
}


madv113
GeneralRe: Serialization problem Pin
NaNg1524122-Apr-07 10:59
NaNg1524122-Apr-07 10:59 
Questionremoting server encountred Pin
kalyan_241621-Apr-07 0:51
kalyan_241621-Apr-07 0:51 
AnswerRe: remoting server encountred Pin
kubben21-Apr-07 1:52
kubben21-Apr-07 1:52 
GeneralRe: remoting server encountred Pin
kalyan_241621-Apr-07 7:22
kalyan_241621-Apr-07 7:22 
QuestionBoxing when calling a member fn on a struct ? Pin
peterchen21-Apr-07 0:22
peterchen21-Apr-07 0:22 
AnswerRe: Boxing when calling a member fn on a struct ? Pin
Christian Graus21-Apr-07 0:44
protectorChristian Graus21-Apr-07 0:44 
GeneralRe: Boxing when calling a member fn on a struct ? Pin
peterchen21-Apr-07 1:07
peterchen21-Apr-07 1:07 
GeneralRe: Boxing when calling a member fn on a struct ? Pin
Christian Graus21-Apr-07 1:17
protectorChristian Graus21-Apr-07 1:17 

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.