[Mono-dev] serialization of structured data in ArrayList

mirek Miroslav.Binas at cnl.tuke.sk
Mon Dec 19 08:26:44 EST 2005


wow - great - it works. thanks a lot :-))

yes - the exception told me what to do, i just didnt know how to use 
xmlinclude.

thanks one more time ;)

maybe - two questions:

1. it is good to use xml serialization or binary? as i read the 
articles, the binary is faster, but maybe not so usefull when need to 
change the configuration file by my own.

2. in this case (of this example code) - is it better to use structure 
Car or class Car?

mirek
Bjarke V. Lindberg wrote:

> mirek wrote:
>
> [Serializable]
>
>> public class Car
>> {
>>  public string type;
>>  public int price;
>>
>    public Car() {}
>
> We'll need a default constructor if we don't implement ISerializable.
>
>>  public Car( string type, int price )
>>  {
>>     this.type = type;
>>     this.price = price;
>>  }
>> }
>>
> We gotta know our Car type.
>
> [Serializable]
> [XmlInclude(typeof(Car))]
>
>> public class Config
>> {
>>  static string filename = ".configrc";
>>
> [...]
>
> The error message of the Exception told you :)
>
> /B.Serializable :)



-- 
e-mail: mirek at host.sk
icq: 113397932
jabber: mirek_b at jabber.sk
homepage: http://www.intrak.sk/~binas

english:
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html

slovak:
prosim, neposielajte mi prilohy vo formatoch .doc a .ppt (power point)
precitajte si http://www.fsf.org/philosophy/no-word-attachments.cs.html




More information about the Mono-devel-list mailing list