Solved

Determining the size of transfer of a remote object

Posted on 2004-08-21
3
189 Views
Last Modified: 2010-05-19
I am trying to determine how big the transfer of a remote call that returns and array of objects is.  Is there any easy way to do this?  
0
Comment
Question by:jjacksn
3 Comments
 
LVL 4

Accepted Solution

by:
Eran_R earned 500 total points
ID: 11872653
If you only need to do this for diagnostic purposes (not every time you are about to make a call, etc),
the answer is simple:

Create an instance of the formatter class used (i.e., if you use soap, create a SoapFormatter object, if you use binary create a BinaryFormatter object).

Then simply call the Serialize() method into a stream and then check the stream length.

Something like:

Object [] array = <...>;
MemoryStream ms = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();

formatter.Serialize(ms, formatter);

Console.WriteLine(ms.Length);


Hope this helps,
Eran
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Any reason why this might be bad? 7 41
Problem with SqlConnection 5 123
C# remove trailing commas from csv file 10 52
Chat Room 1 30
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now