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 6071843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:05:37+00:00 2026-05-23T10:05:37+00:00

This question is simply to satisfy my interest. Reading Choosing Between Classes and Structures

  • 0

This question is simply to satisfy my interest. Reading Choosing Between Classes and Structures the page says “It has an instance size smaller than 16 bytes.”.

Given this simple immutable struct.

public struct Coordinate
{
    private readonly double _latitude;
    private readonly double _longitude;

    public Coordinate(double latitude, double longitude)
    {
        _latitude = latitude;
        _longitude = longitude;
    }

    public double Latitude
    {
        get { return _latitude; }
    }

    public double Longitude
    {
        get { return _longitude; }
    }
}

Do properties also count towards the 16 byte limit? Or do only fields count?

If the latter wouldn’t using a struct fail the guidelines provided by Microsoft since a double is 8 bytes? Two doubles would be 16 bytes which is exactly 16 bytes and not less.

  • 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-23T10:05:37+00:00Added an answer on May 23, 2026 at 10:05 am

    Just the fields count.

    So in this case you’ve got two 64-bit (8 byte) fields; you’re just about within the bounds of your heuristic.

    Note that if you use any auto-implemented properties then the compiler will create “hidden” fields to back those properties, so your overall sum should take those into account too.

    For example, this struct also requires 16 bytes:

    public struct Coordinate
    {
        public Coordinate(double latitude, double longitude) : this()
        {
            Latitude = latitude;
            Longitude = longitude;
        }
    
        public double Latitude { get; private set; }
        public double Longitude { get; private set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Disregard this question: I've simply confused <script src=...></script> tag and <script> [some functions] </scipt>
This may be a painfully simply question for which I will be mocked but
I'm hoping this question has a very simple answer. I can think of ways
This is a really basic question really just to satisfy my curiosity, but is
I've done a good search to see if anyone else has asked this question,
I'm sure this question will be easy for you lot... :) I'm simply trying
After reading this question , I was reminded of when I was taught Java
This is just a question to satisfy my curiosity. But to me it is
(I'm fairly certain the answer to this question is quite simply no but I
I fully admit I am a Ruby newb, and this question could come simply

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.