Sri

Sri

  • NA
  • 19
  • 0

Converting List<> generic to array[]

Jan 29 2008 12:16 PM

I have a web service with a few web methods. They pass around List<CustomobjectDataType> .

[WebMethod]

public List<CustomobjectDataType> webmethod1()

{

// Do something

return (List<CustomobjectDataType>)object;

}

public void WebMethod2()

{

// Do something

List<CustomobjectDataType> obj2 = WebMethod1();

 

}

 

I get a mesmatch saying that the List<> datatype cannot be converted to a

customDataType [] object.

 

Can anyone let me know how I could cast between or covert between List<> and array[] ?

I know ArrayList has a ToArray() but the List<> generic does not. How do I solve this?


Answers (2)