Hi,
I am using my client application a wcf service that retuurns an arrylist.
I want to validate all properties in wcf service class to return all the error messages as arraylist display to user,
in service method no issues it is fine, it is returnig array list.
getting issue in ui "convert type 'object[]' to 'System.Collections.ArrayList"
Please let me know solution if any.
this is my code
// UI class method code
[HttpPost]
public ActionResult Savedetails(DataEntity dataentity)
{
//arraylist
ArrayList arrayOfError = new ArrayList();
try
{
//Passing properties to WCF svc.
arrayOfError = _svcobjClint.SaveData(dataentity);
return RedirectToAction("Index", dataentity);
}
catch (Exception ex)
{
throw ex;
}
}
//Service layer class method code
//Wcf services method
public ArrayList SaveData(DataEntity dataentity)
{
try
{
//validation method it will find the errors and return all errors as arraylist
ValidationsRules(dataentity);
//Validation Start Here (If no errors) it will allows to send property values to datalayer
if (arrayOfError.Count == 0)
{
SaveDatalayer savedatalayer = new SaveDatalayer ();
savedatalayer.Save(dataentity);
}
}
catch (Exception ex)
{
throw ex;
}
//returns the (list of errors as a array list to UI)
return arrayOfError;
}
When I try to compile it i getting this message:
Cannot implicitly convert type 'object[]' to 'System.Collections.ArrayList
What is the problem? how can I get the array list from the webservice?
Thanks in advance,
Anand.