I’m new to web services and im actually trying to learn how to develop one in C#.
I have the following method in my web service which actually displays an array of int when i test it.
[WebMethod]
public int[] FindID(string str1,string str2)
{
Customer obj = new Customer();
obj.FindMatch(str1,str2);
return obj.customer_id;
}
Now in my web application in which i have a button, the code is as below:
Dim obj As localhost.Service = New localhost.Service
Dim str1 As String = Session("str1")
Dim str2 As String = Session("str2")
Response.Write(obj.FindID(str1, str2))
The problem is that only the first value from the array is being displayed. Can anyone please help me to solve this problem?
Console.Writedisplays only a single value such an integer, a float number or a string. It will never walk through an array to display each value.Instead, you can call a
Console.Writeon each entry in your array.Note that calling
Console.Writeis resource expensive. If you need to display values of a very long array, maybe you will achieve better results by using StringBuilder class, then callingConsole.Writeonce.