Trying to construct a helper class that will return an arraylist, but I'm getting the following error, having to do with the xml document I need to create:
Util.oDocument': cannot declare instance members in a static class
I think I understand why you wouldn't want to create a new xmldoc object each time this method gets called, but I need that doc in there for the functionality. How should I be approaching this?
using System;
using System.Collections;
using System.Xml;
public static class Util
{
public static ArrayList multipleArtistList(string artistName)
{
XmlDocument oDocument = new XmlDocument();
string uri = "http://api.leoslyrics.com/api_search.php?auth=duane&artist=" + artistName;
oDocument.Load(uri);
XmlNodeList results = oDocument.GetElementsByTagName("name");
ArrayList artistList = new ArrayList();
for (int i = 0; i < results.Count; i++)
{
if (!artistList.Contains(results[i].InnerText))
{
artistList.Add(results[i].InnerText);
}
}
return artistList;
}
}