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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:43:51+00:00 2026-05-11T19:43:51+00:00

I am wondering how immutability is defined? If the values aren’t exposed as public,

  • 0

I am wondering how immutability is defined? If the values aren’t exposed as public, so can’t be modified, then it’s enough?

Can the values be modified inside the type, not by the customer of the type?

Or can one only set them inside a constructor? If so, in the cases of double initialization (using the this keyword on structs, etc) is still ok for immutable types?

How can I guarantee that the type is 100% immutable?

  • 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-11T19:43:51+00:00Added an answer on May 11, 2026 at 7:43 pm

    If the values aren’t exposed as public, so can’t be modified, then it’s enough?

    No, because you need read access.

    Can the values be modified inside the type, not by the customer of the type?

    No, because that’s still mutation.

    Or can one only set them inside a constructor?

    Ding ding ding! With the additional point that immutable types often have methods that construct and return new instances, and also often have extra constructors marked internal specifically for use by those methods.

    How can I guarantee that the type is 100% immutable?

    In .Net it’s tricky to get a guarantee like this, because you can use reflection to modify (mutate) private members.

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

Sidebar

Related Questions

Wondering if anyone can help me with this annoying but trivial (in terms of
Wondering if there's any not-too-hard way to edit non-form text in html 4. I
Just wondering if a .NET app can be compiled down to native machine code
Wondering if I'm going about this the right way or not. I have 3
Wondering how I can send a DELETE instead of POST/GET etc with ASIHTTPRequest. Thanks!
Wondering if anyone can help me understand how the localisation works with keywords. I
Wondering if anyone here can offer any insight into the ups/downs of using the
wondering if anyone can help me. I've been searching for a few days for
Wondering if anybody knows where I can find any high resolution pictures for iPhone,
Wondering if someone can answer something that has stumped me. I have a Timer

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.