Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Determining the size of transfer of a remote object

Posted on 2004-08-21
3
Medium Priority
?
196 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

916 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