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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:19:55+00:00 2026-05-25T06:19:55+00:00

Looking into the .NET code, Rectangle.Size returns new Size(Width, Height) . Why did Microsoft

  • 0

Looking into the .NET code, Rectangle.Size returns new Size(Width, Height). Why did Microsoft choose this pattern? Personally, I would have thought that Size would be stored within the structure, and Rectangle.Width, for example, would return Size.Width. This would prevent a new structure from being created every property call. I’m guessing that there are some properties of immutability that influenced this decision, but I’m not sure what.

  • 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-25T06:19:55+00:00Added an answer on May 25, 2026 at 6:19 am

    Size is a struct, so it’s not like it’s creating a new object on the heap. It will create a new copy of a Size value whatever you do.

    I can’t see that it’s going to make much difference either way, to be honest. Given that the Width and Height properties of Size are inlined, I can see that there wouldn’t be much penalty from storing a Size as you suggest… but equally I can see that the constructor for Size is so trivial that the JIT may well be able to convert the Rectangle.Size property to almost exactly the same native code.

    So I agree it’s a slightly odd decision, but I don’t think it’s going to hurt anyone much. Perhaps it makes serialization simpler or something like that.

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

Sidebar

Related Questions

I was looking into using some .NET code from within a Delphi program, I
I found this strange behaviour in .NET and even after looking into CLR via
My company is looking into ASP.NET and Prism. We are wondering how much code
I have been looking into refactoring some old code into a new WCF service,
I've recently been looking into targeting the .NET Client Profile for a WPF application
I recently started looking into building web applications using .NET MVC and I stumbled
I have just been looking into Linq with ASP.Net. It is very neat indeed.
I'm looking into the ESB thing with .net like NServiceBus etc , can someone
Which C#/.NET Dependency Injection frameworks are worth looking into? And what can you say
I am looking into building an authentication in my ASP.NET application with the following

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.