milani_lucie
asked on
Cannot implicitly convert type 'Person[]' to 'System.Collections.Generic.List<Person> ==== Web Service Proxy Modifications - C# / ASP.NET
Hi,
I have the below code generated by WSDL.EXE for Proxy. But i want to have the List<Person> instead of Person[] as my front end UI requires a List instead of Array.
/// <remarks/>
[System.Web.Services.Proto cols.SoapD ocumentMet hodAttribu te("http://tempuri.org/Load", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.De scription. SoapBindin gUse.Liter al, ParameterStyle=System.Web. Services.P rotocols.S oapParamet erStyle.Wr apped)]
public Person[] Load() {
object[] results = this.Invoke("Load", new object[0]);
return ((Person[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginLoad(System.AsyncCall back callback, object asyncState) {
return this.BeginInvoke("Load", new object[0], callback, asyncState);
}
/// <remarks/>
public Person[] EndLoad(System.IAsyncResul t asyncResult) {
object[] results = this.EndInvoke(asyncResult );
return ((Person[])(results[0]));
}
/// <remarks/>
public void LoadAsync() {
this.LoadAsync(null);
}
/// <remarks/>
public void LoadAsync(object userState) {
if ((this.LoadOperationComple ted == null)) {
this.LoadOperationComplete d = new System.Threading.SendOrPos tCallback( this.OnLoa dOperation Completed) ;
}
this.InvokeAsync("Load", new object[0], this.LoadOperationComplete d, userState);
}
private void OnLoadOperationCompleted(o bject arg) {
if ((this.LoadCompleted != null)) {
System.Web.Services.Protoc ols.Invoke CompletedE ventArgs invokeArgs = ((System.Web.Services.Prot ocols.Invo keComplete dEventArgs )(arg));
this.LoadCompleted(this, new LoadCompletedEventArgs(inv okeArgs.Re sults, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState );
}
I want to modify the code generated by WSDL tool. So can you please modify the above code to have the List instead of Array ?
List<Person> instead of Person[].
Carefully look at this code:
/// <remarks/>
public Person[] EndLoad(System.IAsyncResul t asyncResult) {
object[] results = this.EndInvoke(asyncResult );
return ((Person[])(results[0]));
}
Thanks
I have the below code generated by WSDL.EXE for Proxy. But i want to have the List<Person> instead of Person[] as my front end UI requires a List instead of Array.
/// <remarks/>
[System.Web.Services.Proto
public Person[] Load() {
object[] results = this.Invoke("Load", new object[0]);
return ((Person[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginLoad(System.AsyncCall
return this.BeginInvoke("Load", new object[0], callback, asyncState);
}
/// <remarks/>
public Person[] EndLoad(System.IAsyncResul
object[] results = this.EndInvoke(asyncResult
return ((Person[])(results[0]));
}
/// <remarks/>
public void LoadAsync() {
this.LoadAsync(null);
}
/// <remarks/>
public void LoadAsync(object userState) {
if ((this.LoadOperationComple
this.LoadOperationComplete
}
this.InvokeAsync("Load", new object[0], this.LoadOperationComplete
}
private void OnLoadOperationCompleted(o
if ((this.LoadCompleted != null)) {
System.Web.Services.Protoc
this.LoadCompleted(this, new LoadCompletedEventArgs(inv
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState
}
I want to modify the code generated by WSDL tool. So can you please modify the above code to have the List instead of Array ?
List<Person> instead of Person[].
Carefully look at this code:
/// <remarks/>
public Person[] EndLoad(System.IAsyncResul
object[] results = this.EndInvoke(asyncResult
return ((Person[])(results[0]));
}
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
object[] results = this.EndInvoke(asyncResult
return ((Person[])(results[0])).ToList();
}