public static bool GetCollectionValue(XmlNode xml, string xpath, out IList <Attachment> objCollection) { XmlNodeList nodes = XmlLoader.GetNodes(xml, xpath); if (nodes != null) { objCollection = new List <Attachment>(); foreach (XmlNode node in nodes) { try { Attachment attachment; if (GetAttachmentValue(node, out attachment)) { objCollection.Add(attachment); } continue; } catch (Exception exception) { Console.WriteLine(exception.ToString()); continue; } } return(objCollection.Count > 0); } objCollection = null; return(false); }