NetCF version 2.0 supports XMLSerialzier. Are there performance tips to make the XMLSerializer faster?
Serialization metadata for a given type is built when a corresponding XmlSerializer is created: new XmlSerializer(typeof(MyType)); (Metadata is built for type MyType) Building this metadata is expensive so the metadata is cached by the XmlSerializer. It is recommended that applications only create one XmlSerializer instance per type to reduce the amount of time spent searching for metadata. Use the “Singleton pattern”. If serializing several types use FromTypes(): // Create the list of serializer Type[] types = new Type[]{typeof(MyType1), typeof(MyType2)}; XmlSerializer[] serializers = XmlSerializer.FromTypes(types); // Serialize an instance of MyType1 MyType1 mt1 = new MyType1(); serializers[0].
Related Questions
- NET Compact Framework version 2.0 supports generics. Are generic collections any faster than non-generic collections?
- Was there a version of the 30th Anniversary T/A available in a Firehawk by Street Legal Performance(SLP)?
- NetCF version 2.0 supports XMLSerialzier. Are there performance tips to make the XMLSerializer faster?