Reputation: 1674
I am trying to port some VB.NET code which used these global variables docArray, and docputResponse to C# without global variables and trying to pass around to various methods in two projects.
These are of the following types which I declared in my web service Gilbane.RREM.Interfaces namespace:
Gilbane.Common.SSHIP_Prod_Interface5.documentValue[] docArray
Gilbane.Common.SSHIPDocumentServiceProd.putDocumentSvcResponse[] docputResponse
The first method I am trying to pass to, I have declared these by reference since they will be changed down the line:
public bool SendDocument(interface5toSSHIP row, FileType file, int i, ref Gilbane.Common.SSHIP_Prod_Interface5.documentValue[] docArray, ref Gilbane.Common.SSHIPDocumentServiceProd.putDocumentSvcResponse[] docputResponse)
I kept getting errors until I declared these at the top of my web service:
Gilbane.Common.SSHIP_Prod_Interface5.documentValue[] docArray = new documentValue[7];
Gilbane.Common.SSHIPDocumentServiceProd.putDocumentSvcResponse[] docputResponse = new putDocumentSvcResponse[7];
When I do that, it won't let me pass just docArray.
public bool SendDocument(interface5toSSHIP row, FileType file, int i, ref Gilbane.Common.SSHIP_Prod_Interface5.documentValue[] docArray, ref Gilbane.Common.SSHIPDocumentServiceProd.putDocumentSvcResponse[] docputResponse)
It says Parameter docArray hides field 'documentValue[] Gilbane.RREM.Interface5.docArray.' Same for docputResponse.
Then in SendDocument, I need to call a method:
if (document.SendDocument(ba, appId, "GILBANE_I5_", file, ref docId, 5, InterfaceType.Interface5, ref this.docArray, ref this.docputResponse, i))
Arument 8 should not be passed with the ref keyword Argument 9 should not be passed with the ref keyword
document.SendDocument is spec'd as:
public bool SendDocument(byte[] fileToSend, string appId, string filePrefix, FileType file, ref string docId,
int interfaceId, InterfaceType typeOfInterface, ref SSHIP_Prod_Interface5.documentValue[] docArray, ref SSHIPDocumentServiceProd.putDocumentSvcResponse[] putResponse, int i)
Can someone pleae help me get this typing correct and these calls working?
Upvotes: 0
Views: 67
Reputation: 1135
You should not need to pass the arrays by ref if your intention is to only view/modify its contents. Simply removing the ref keyword from your method declarations and calls should fix the issue.
Upvotes: 1