Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7674999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:51:45+00:00 2026-05-31T16:51:45+00:00

i have data structure i am passing this from server to client using data

  • 0

i have data structure i am passing this from server to client using data contract.
the data structure is

class datatransfer
{
    double m_value1;

    double m_value2;

    double m_value3;
};

in the client i want to write into file.

  • The idea is to convert the values of the data transfer into string using string builder
    than transfer the string to the client.

or

  • send the data structure and write the file using stream writer

which is the best approach? converting to string or send the datastructure and write to the file?

Reason for the question: to avoid the generation of string.

double size is 8 bytes. If i convert it to string what will be the size allocated .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:51:46+00:00Added an answer on May 31, 2026 at 4:51 pm

    It depends entirely on how you format the String representation of the Double. There is no pre-defined sizing guideline.

    For example:

    var myDouble = 5.183498029834092834D;
    
    var shortString = myDouble.ToString("#.00"); // 5.18, uses 8 bytes
    var longerString = myDouble.ToString("#.0000000"); // 5.1834980 18 bytes
    

    Note that the sizes are the result of a Char being 2 bytes on my system.

    What you’re really trying to do is called serialization. There’s a number of ways to do this. The simplest of which may be to just decorate your class with the [Serializable] attribute:

    [Serializable]
    public class datatransfer {
        double m_value1;
        double m_value2;
        double m_value3;
    }
    

    You’ll need to make your member variables public, or provide publicly accessible properties for setting the member variables. Otherwise they will not be serialized using this approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data structure that represents C# code like this: class Namespace: string
I have a data structure which is as given below: class File { public
I am passing some JSON back from client-side to server-side. if (historicalJSONAttributes != null)
I have a data structure which uses composite ids (Which I dont wish to
I have a data structure defined as struct myDataStruct { int32_t header; int16_t data[8];
I have a data structure where an entity has times stored as an int
Guys, I have a data structure which has 25 distinct keys (integer) and a
I have the following data structure (a list of lists) [ ['4', '21', '1',
I have a tree data structure that is L levels deep each node has
In Perl, when you have a nested data structure, it is permissible to omit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.