
Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
Thanks both for the replies.
I am trying to simply copy the values from one to the other, however I
found this on MSDN:
"Try to reduce the number of calls used to complete a logical unit of
work. The following code shows an example of calling a component, by
using a chatty interface. Notice how the inefficient (chatty)
interface design forces the caller to traverse the remoting boundary
three times to perform the single task of saving customer details.
MyComponent.Firstname = "bob";
MyComponent.LastName = "smith";
MyComponent.SaveCustomer();
The following code shows how the same functionality should be
implemented to reduce the operations and boundary crossings required
to complete the single logical operation.
MyComponent.SaveCustomer( "bob", "smith");"
The top example is exactly what I'm doing, about a hundred times
though and seems to be slowing down this application. I have used the
lower example but when the number of paramters grew to about 100, I
decided to use an object (Namespace1.MyClass) instead.
I could go back to passing parameters. Other than the admin headache,
is there any disadvantage to passing 100 parameters?
I appreciate the help, thanks again.
Nicholas Paldino [.NET/C# MVP] - 06 Feb 2008 17:38 GMT
Looch,
No, not really. It's assumed the parameters are going to be smaller
than what it would take to remote a full class instance over (since you are
breaking it down).
The important thing is to reduce the number of calls. Whether you send
a class, or 100 parameters, the remoting infrastructure is going to make one
call across the network (instead of making 100 calls for setting each
property).

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
> Thanks both for the replies.
>
[quoted text clipped - 26 lines]
>
> I appreciate the help, thanks again.
Ignacio Machin ( .NET/ C# MVP ) - 06 Feb 2008 19:10 GMT
Hi,
> Thanks both for the replies.
> The following code shows how the same functionality should be
> implemented to reduce the operations and boundary crossings required
> to complete the single logical operation.
>
> MyComponent.SaveCustomer( "bob", "smith");"
It does make sense, you are minimizing the transfer.
> The top example is exactly what I'm doing, about a hundred times
> though and seems to be slowing down this application. I have used the
> lower example but when the number of paramters grew to about 100, I
> decided to use an object (Namespace1.MyClass) instead.
100 parameters??? You mean you have a class with 100 properties?
I honestly never seen such a class.
There might me a better solution tough. If both classes define the same
properties and you can use reflection to copied them in a loop. Much better
than pass 100 parameters !!!