I prefer using arrays and its collection-like counterpart, the
arraylist. When using an arraylist, you have the add and remove and
removeat methods, but the key for transferring between two objects is
the .ToArray and the .AddRange methods. The former converts the
arraylist into a literal array of objects. You can do it with Option
strict on too, but it's a bit more verbose:
dim x as dtoObject ' For illustration only
dim al as arraylist
dim obj as new webservice
obj.callingMethod(ctype(al.toarray(gettype(dtoObje ct)),dtoObject())
So what you're saying is convert the arraylist to array of type
dtoObject, but ToArray returns an object (subtype dtoObject()), so you
have to strong type it back to dtoObject()
Then when you receive it as an input parameter, its as simple as
public sub InMethod(dto() as dtoObject)
al.addrange(dto)
end sub
Hope that helps. It might not be the answer you wanted, but it is a
very easy technique that you should try. If you have a specific need to
use a Collection type, let me know and I'll clarify my answer.
vbvjain <vb************@mail.codecomments.com> wrote in
news:vb************@mail.codecomments.com:
I am developing an applocation which reads mails in outlook inbox
alongwith attachments and all these informmation is stored in a
collection which i need to pass it to a web service, which will
perform certain operations on that collection and then return that
modified collection to the client.
but when i am trying to pass a simple collection of strings to my web
service it gives me an error "You must implement Add(System.Object) as
it inherits from IColletion".
Can someone tell me the exact way as to how i can pass collection to
and from a web service in VB.NET
Thanks in advance
--
vbvjain
-----------------------------------------------------------------------
- Posted via http://www.codecomments.com
-----------------------------------------------------------------------
-