>> public object[,] FindIdsByEmails(object[] emailarray) >> { >> int emailslen = emailarray.Length; >> object[,] returnarray = new object[emailslen, 2]; >> for (int i = 0; i < emailslen; i++) >> { >> string email = (string)emailarray[i]; >> long? id = this.FindIdByEmail(email); >> returnarray[i, 0] = email; >> if (id != null) >> { >> returnarray[i, 1] = id; >> } >> else >> { >> returnarray[i, 1] = 00000; >> } >> } >> return returnarray; >> } >>>>
>>CD "c:\users\pagan\documents\visual studio 2010\projects\glwebservice\glwebservice\bin\debug" >>ACTIVATE WINDOW watch >>lows = CREATEOBJECT("glwebservice.glclient") >>lows.login("xxxxxx@xxxxx.org", "password", "<security key") >> >>DIMENSION foo(4) >> >>foo(1)="dan@primarydatasolutions.com" >>foo(2)="charleshankey@f1tech.com" >>foo(3) = "raferris@hsonline.net" >>foo(4) = "foo@foo.net" >>DIMENSION ids(4,2) >> >>comarray(lows,0) >> >>* here's where I get the error >> >>ids = lows.FindIdsByEmails(@foo) >> >>lows.logout >>lows = null >> >>RETURN >> >> >>>>
CD "c:\users\pagan\documents\visual studio 2010\projects\glwebservice\glwebservice\bin\debug" ACTIVATE WINDOW watch SET STEP ON lows = CREATEOBJECT("glwebservice.glclient") lows.login("mquigley@sba-list.org", "Sbalist123!", "RUIbS9BPsZ7TkyCRCl6B89Gi") DIMENSION foo(4,2) foo(1,1)="dan@primarydatasolutions.com" foo(2,1)="charleshankey@f1tech.com" foo(3,1) = "raferris@hsonline.net" foo(4,1) = "foo@foo.net" foo(1,2) = 0 foo(2,2) = 0 foo(3,2) = 0 foo(4,2) = 0 comarray(lows,0) * doesn't this pass the array by reference ??? =lows.FindIdsByEmails(@foo) lows.logout lows = null RETURNHere is the refactored C# - once again works like a charm inside C# test harness
public void FindIdsByEmails(object[,] emailarray) { int emailslen = emailarray.GetLength(0); for (int i = 0; i < emailslen; i++) { string email = (string)emailarray[i,0]; long? id = this.FindIdByEmail(email); if (id != null) { emailarray[i, 1] = id; } else { emailarray[i, 1] = 00000; } } }