How to convert recursive procedure with side effects on ref param to recursive function returning a list?
问题 It seems every time I go to write a recursive function I end up making it return void and using a ref parameter. I'd much rather be able to write a function that just returns a result list. Apologies if the answer is very simple - for some reason it elludes me. Here's the code I have now: public static void GetResrouces(string startURL, ref List<XDocument> result) { var doc = XDocument.Parse(GetXml(startURL)); // GetXml ommitted - returns xml string var xs = new XmlSerializer(typeof