Click here to Skip to main content
15,895,880 members
Home / Discussions / C#
   

C#

 
GeneralRe: Developing a Client/Server application Pin
Niels Penneman8-Jan-04 6:22
Niels Penneman8-Jan-04 6:22 
GeneralRe: Developing a Client/Server application Pin
Kingvest8-Jan-04 6:26
Kingvest8-Jan-04 6:26 
GeneralRe: Developing a Client/Server application Pin
Niels Penneman8-Jan-04 7:20
Niels Penneman8-Jan-04 7:20 
GeneralRe: Developing a Client/Server application Pin
Guillermo Rivero8-Jan-04 6:28
Guillermo Rivero8-Jan-04 6:28 
GeneralRe: Developing a Client/Server application Pin
Heath Stewart8-Jan-04 5:46
protectorHeath Stewart8-Jan-04 5:46 
GeneralRe: Developing a Client/Server application Pin
Kingvest8-Jan-04 5:51
Kingvest8-Jan-04 5:51 
GeneralRe: Developing a Client/Server application Pin
bnieland8-Jan-04 6:24
bnieland8-Jan-04 6:24 
Generalinelegance Pin
TuringTest17-Jan-04 21:41
TuringTest17-Jan-04 21:41 
GeneralRe: inelegance Pin
Philip Fitzsimons8-Jan-04 3:28
Philip Fitzsimons8-Jan-04 3:28 
GeneralRe: inelegance Pin
leppie8-Jan-04 6:07
leppie8-Jan-04 6:07 
GeneralRe: inelegance Pin
Philip Fitzsimons8-Jan-04 6:16
Philip Fitzsimons8-Jan-04 6:16 
GeneralRe: inelegance Pin
TuringTest18-Jan-04 6:26
TuringTest18-Jan-04 6:26 
GeneralRe: inelegance Pin
leppie8-Jan-04 6:56
leppie8-Jan-04 6:56 
GeneralRe: inelegance Pin
TuringTest18-Jan-04 7:34
TuringTest18-Jan-04 7:34 
GeneralAbstract, Interface, and Attribute Pin
TuringTest17-Jan-04 20:40
TuringTest17-Jan-04 20:40 
GeneralRe: Abstract, Interface, and Attribute Pin
Mazdak7-Jan-04 20:56
Mazdak7-Jan-04 20:56 
GeneralRe: Abstract, Interface, and Attribute Pin
TuringTest17-Jan-04 21:32
TuringTest17-Jan-04 21:32 
GeneralRe: Abstract, Interface, and Attribute Pin
Heath Stewart8-Jan-04 5:32
protectorHeath Stewart8-Jan-04 5:32 
Actually, if you attribute your class with the SerializableAttribute, the default serialization will serialize public and private fields of your class. There is an interface, ISerializable, that allows you to control the serialization so that you, the developer, controls what gets serialized and what doesn't. This does go along - like the original poster mentioned - with a constructor that has the signature (SerializationInfo, StreamingContext). This constructor can have any access modifier, but are common protected so that subclasses can pass serialization info to its base class.

There are also other serialization interfaces that can be useful, such as the IDeserializationCallback that allows you to perform any layout or hook-ups after serialization is complete, and the ISerializationSurrogate that - with an IFormatter implementation allows you to serialize Types that are themselves serializable. You can also use a SerializationBinder with the formatter to serialize from one Type to another, using SerializationBinder.BindToType. This seems especially handy when you have to upgrade a serialized file with older versions of Types.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: Abstract, Interface, and Attribute Pin
TuringTest18-Jan-04 5:51
TuringTest18-Jan-04 5:51 
GeneralRe: Abstract, Interface, and Attribute Pin
Heath Stewart8-Jan-04 5:53
protectorHeath Stewart8-Jan-04 5:53 
GeneralRe: Abstract, Interface, and Attribute Pin
TuringTest18-Jan-04 6:01
TuringTest18-Jan-04 6:01 
GeneralRe: Abstract, Interface, and Attribute Pin
Heath Stewart8-Jan-04 6:12
protectorHeath Stewart8-Jan-04 6:12 
GeneralRe: Abstract, Interface, and Attribute Pin
TuringTest18-Jan-04 6:39
TuringTest18-Jan-04 6:39 
GeneralRe: Abstract, Interface, and Attribute Pin
Heath Stewart8-Jan-04 7:13
protectorHeath Stewart8-Jan-04 7:13 
GeneralRe: Abstract, Interface, and Attribute Pin
TuringTest18-Jan-04 7:50
TuringTest18-Jan-04 7:50 

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.