how to call a function in c# which return type is array.

Posted by Manoj Wadhwani on Stack Overflow See other posts from Stack Overflow or by Manoj Wadhwani
Published on 2010-04-28T06:57:07Z Indexed on 2010/04/28 7:03 UTC
Read the original article Hit count: 186

Filed under:
public CD[] GetCDCatalog()
{
    XDocument docXML =
    XDocument.Load(Server.MapPath("mydata.xml"));

    var CDs =
      from cd in docXML.Descendants("Table")
      select new CD
      {
          title = cd.Element("title").Value,
          star = cd.Element("star").Value,
          endTime = cd.Element("endTime").Value,

      };
    return CDs.ToArray<CD>();
}

I am calling this function on page load ie. string[] arr = GetCDCatalog(); but this is giving Error Cannot implicitly convert type 'Calender.CD[]' to 'string[]' Please suggetst how can i call function on page load which return type is array.

© Stack Overflow or respective owner

Related posts about c#