I have a Service hosted which will process array received(ByRef) .
I have a method in the application which will take strings from the user, add it to the array object and call the ServiceMethod to have the Array processed(which is passed ByRef), then i will show you the result on screen.
What i Understand
When any thing is passed by reference, the memory location is passed therefore any action taken on the "thing" is taken on the location of the "thing".
For the "thing" to be on the same PC/Memory its okay. but
What happens when the "thing" is on a different PC? What does the Receiver do? Does it access the memory bit by bit of the sender which is thousands of miles away?
It really depends on the very precise scenario. Regular WCF will generally interpret ref
as a "serialize this data to the service, let the service play with it, then serialize the data back to the client" - so the semantic of ref
is then similar, but the implementation is very different. During usage, the server is only talking to the local copy of the data, so there is no huge performance issue - however, if you send a huge byte[]
and then only access 2 bytes from it, is still has to send all that data twice (both directions).