private bool AtLeastOneOfCollectionMembersExists(XElement elem, MemberWrapper member)
{
if (!((member.IsTreatedAsCollection || member.IsTreatedAsDictionary) && member.CollectionAttributeInstance != null &&
member.CollectionAttributeInstance.SerializationType == YAXCollectionSerializationTypes.RecursiveWithNoContainingElement))
throw new ArgumentException("member should be a collection serialized without containing element");
XName eachElementName = null;
if (member.CollectionAttributeInstance != null)
{
eachElementName = StringUtils.RefineSingleElement(member.CollectionAttributeInstance.EachElementName);
}
if (member.DictionaryAttributeInstance != null && member.DictionaryAttributeInstance.EachPairName != null)
{
eachElementName = StringUtils.RefineSingleElement(member.DictionaryAttributeInstance.EachPairName);
}
if (eachElementName == null)
{
Type colItemType = ReflectionUtils.GetCollectionItemType(member.MemberType);
eachElementName = StringUtils.RefineSingleElement(ReflectionUtils.GetTypeFriendlyName(colItemType));
}
// return if such an element exists
return (elem.Element(eachElementName.OverrideNsIfEmpty(member.Namespace.IfEmptyThen(TypeNamespace).IfEmptyThenNone())) != null);
}