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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:56:16+00:00 2026-05-18T11:56:16+00:00

I got a bit of a surprise today when I changed the value of

  • 0

I got a bit of a surprise today when I changed the value of a publicly-visible constant in a static class and then replaced an old copy of the assembly with the newly-compiled version. The surprise was that the existing program that referenced the assembly didn’t pick up the new value of the constant. That is, I didn’t re-compile the executable but rather just replaced that one assembly.

A full description of my experiment is at How constant is a constant?

I’ll admit to being very surprised by this behavior. I understand what’s going on, but I don’t understand why. Is there a particular technical reason why constants couldn’t be picked up at JIT time rather than compile time? Are there cases where doing that would break things?

  • 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-18T11:56:17+00:00Added an answer on May 18, 2026 at 11:56 am

    Constants are supposed to be constant. For all time. Constants are things like the value of pi, or the number of protons in a lead atom.

    If your constant changes, it wasn’t really a constant; use a readonly field instead.

    Also see the Framework Design Guidelines, which state:

    Use constant fields for constants that will never change. The compiler burns the values of const fields directly into calling code. Therefore const values can never be changed without the risk of breaking compatibility.

    Essentially, changing a constant without recompiling everything that depends on it is every bit as broken as changing the signature of a method without recompiling everything that depends on it. The compiler “bakes in” all kinds of assumptions about information about metadata from referenced assemblies when it compiles a dependent assembly. If you make any change, you cannot expect things to simply keep on working.

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

Sidebar

Related Questions

I've got a bit of Django form code that looks like this: class GalleryAdminForm(forms.ModelForm):
I just got bit by assuming the following: foreach ($arr as $key => $value)
I got a bit confused, because when I use the generic ListView class, Django
I've got a bit of a problem with making my data loading and filtering
I've got this bit of JQUERY: <script> function initNav() { $('.nav tr table td
I've got a bit of an odd issue here. Basically it only occurs in
I've got a bit of a problem. Essentially, I need to store a large
I've got a bit of a complicated set up. I specialise in XSLT which
I've got a bit of fettish for language design and I'm currently playing around
I've got a bit of Mac code that needs to store, access and update

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.