private static bool ShouldInclude(ArrayMapping arrayMapping) {
if (arrayMapping.ReferencedByElement)
return false;
if (arrayMapping.Next != null)
return false;
if (arrayMapping.Elements.Length == 1) {
TypeKind kind = arrayMapping.Elements[0].Mapping.TypeDesc.Kind;
if (kind == TypeKind.Node)
return false;
}
for (int i = 0; i < arrayMapping.Elements.Length; i++) {
if (arrayMapping.Elements[i].Name != arrayMapping.Elements[i].Mapping.DefaultElementName) {
// in the case we need custom attributes to serialize an array instance, we cannot include arrau mapping without explicit reference.
return false;
}
}
return true;
}