namespace System.Xml.Serialization
{
- internal class SerializationSource
+#if !NET_2_1 || MONOTOUCH
+ internal abstract class SerializationSource
{
- ArrayList includedTypes;
+ Type[] includedTypes;
string namspace;
bool canBeGenerated = true;
- public SerializationSource (string namspace, ArrayList includedTypes)
+ public SerializationSource (string namspace, Type[] includedTypes)
{
this.namspace = namspace;
this.includedTypes = includedTypes;
}
- public override bool Equals (object o)
+ protected bool BaseEquals (SerializationSource other)
{
- SerializationSource other = o as SerializationSource;
- if (other == null) return false;
if (namspace != other.namspace) return false;
if (canBeGenerated != other.canBeGenerated) return false;
if (includedTypes == null)
return other.includedTypes == null;
- if (includedTypes.Count != other.includedTypes.Count) return false;
- for (int n=0; n<includedTypes.Count; n++)
+ if (other.includedTypes == null || includedTypes.Length != other.includedTypes.Length) return false;
+ for (int n=0; n<includedTypes.Length; n++)
if (!includedTypes[n].Equals (other.includedTypes[n])) return false;
return true;
Type type;
string rootHash;
- public XmlTypeSerializationSource (Type type, XmlRootAttribute root, XmlAttributeOverrides attributeOverrides, string namspace, ArrayList includedTypes)
+ public XmlTypeSerializationSource (Type type, XmlRootAttribute root, XmlAttributeOverrides attributeOverrides, string namspace, Type[] includedTypes)
: base (namspace, includedTypes)
{
if (attributeOverrides != null) {
if (rootHash != other.rootHash) return false;
if (attributeOverridesHash != other.attributeOverridesHash) return false;
- return base.Equals (o);
+ return base.BaseEquals (other);
}
public override int GetHashCode ()
string attributeOverridesHash;
Type type;
- public SoapTypeSerializationSource (Type type, SoapAttributeOverrides attributeOverrides, string namspace, ArrayList includedTypes)
+ public SoapTypeSerializationSource (Type type, SoapAttributeOverrides attributeOverrides, string namspace, Type[] includedTypes)
: base (namspace, includedTypes)
{
if (attributeOverrides != null) {
if (!type.Equals(other.type)) return false;
if (attributeOverridesHash != other.attributeOverridesHash) return false;
- return base.Equals (o);
+ return base.BaseEquals (other);
}
public override int GetHashCode ()
bool literalFormat;
public MembersSerializationSource (string elementName, bool hasWrapperElement, XmlReflectionMember [] members, bool writeAccessors,
- bool literalFormat, string namspace, ArrayList includedTypes)
+ bool literalFormat, string namspace, Type[] includedTypes)
: base (namspace, includedTypes)
{
this.elementName = elementName;
if (hasWrapperElement != other.hasWrapperElement) return false;
if (membersHash != other.membersHash) return false;
- return base.Equals (o);
+ return base.BaseEquals (other);
}
public override int GetHashCode ()
return membersHash.GetHashCode ();
}
}
+#endif
- internal class KeyHelper
- {
- public static void AddField (StringBuilder sb, int n, string val)
- {
- AddField (sb, n, val, null);
- }
-
- public static void AddField (StringBuilder sb, int n, string val, string def)
- {
- if (val != def) {
- sb.Append (n.ToString());
- sb.Append (val.Length.ToString(CultureInfo.InvariantCulture));
- sb.Append (val);
- }
- }
-
- public static void AddField (StringBuilder sb, int n, bool val)
- {
- AddField (sb, n, val, false);
- }
-
- public static void AddField (StringBuilder sb, int n, bool val, bool def)
- {
- if (val != def)
- sb.Append (n.ToString());
- }
-
- public static void AddField (StringBuilder sb, int n, int val, int def)
- {
- if (val != def) {
- sb.Append (n.ToString());
- sb.Append (val.ToString(CultureInfo.InvariantCulture));
- }
- }
-
- public static void AddField (StringBuilder sb, int n, Type val)
- {
- if (val != null) {
- sb.Append (n.ToString(CultureInfo.InvariantCulture));
- sb.Append (val.ToString());
- }
- }
- }
}