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

  • Home
  • SEARCH
  • 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 7797351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:39:24+00:00 2026-06-01T23:39:24+00:00

I have a client application that connects to a WCF service, I get the

  • 0

I have a client application that connects to a WCF service, I get the file size from the server as a long value then I convert it at the client to string so it appears like ex:52.21 MB

The application gets too many files sizes every time user changes the current directory path.

My question: Should I convert the values to string format from the WCF service app then return it to the client as a string or should I just return the size as a long value and let the client to convert it to a string format

In other way which value take more bytes in the memory:

long size = 55050240;
string size = "52.5 MB"; 

long large_size = 56371445760;
string large_size = "52.5 GB";

UPDATE:

I use this method to convert long value to a string format:

private string ConvertUnit(long source)
    {
        const int byteConversion = 1024;
        double bytes = Convert.ToDouble(source);

        if (bytes >= Math.Pow(byteConversion, 3)) //GB Range
        {
            return string.Concat(Math.Round(bytes / Math.Pow(byteConversion, 3), 2), " GB");
        }
        else if (bytes >= Math.Pow(byteConversion, 2)) //MB Range
        {
            return string.Concat(Math.Round(bytes / Math.Pow(byteConversion, 2), 2), " MB");
        }
        else if (bytes >= byteConversion) //KB Range
        {
            return string.Concat(Math.Round(bytes / byteConversion, 2), " KB");
        }
        else //Bytes
        {
            return string.Concat(bytes, " Bytes");
        }
    }

Short question: Which takes more memory, string value or long value?

  • 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-06-01T23:39:25+00:00Added an answer on June 1, 2026 at 11:39 pm

    Having a service layer that output values that are formatted is a very bad idea. What happens if the requirements change and rather than a GB suffix, the client application UI needs to output in bytes? e.g. 56,371,445,760 ? This will required the client application to parse then re-format the data sent by the server.

    Also, determining the memory required to store an individual variable is easy. What is not so easy is to work out the overall impact to your application. Different types will be handled differently in your code, and as a result a smaller variable might incur a greater cost.

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

Sidebar

Related Questions

Lets suppose I have an .NET client application that connects to a WCF service,
I have client application that uses WCF service to insert some data to backend
I have a client server application that sends XML over TCP/IP from client to
I have a client application that connects to a web service over https. I
I have written an application that connects to a SSL web service (including client
We have a client application that needs to send messages to a server for
I have a client/server application that communicates with .Net remoting. I need my clients
i have a server - client application that runs on java 1.3; i want
I have a client-server application that uses .net remoting. The clients are in a
I have a .NET client application that needs to communicate with a server using

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.