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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:34:00+00:00 2026-06-11T02:34:00+00:00

While just playing with c#, realized a strange thing. Here is the code: class

  • 0

While just playing with c#, realized a strange thing.

Here is the code:

class Program
{
    static void Main(string[] args)
    {
        System.Diagnostics.Debug.Write(string.Empty);

        typeof(string)
            .GetField("Empty", BindingFlags.Static | BindingFlags.Public)
            .SetValue(null, "Tolgahan");


        Console.WriteLine(string.Empty);

        // output : Tolgahan
    }
}

Why reflection let us to change readonly fields?


The question is “why the setting via reflection is allowed”, not “how to do it”, so it is not a duplicate of Can I change a private readonly field in C# using reflection?.

  • 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-11T02:34:02+00:00Added an answer on June 11, 2026 at 2:34 am

    In the same way the laws of chemistry say that no reaction can cause an atom of one element to change into an atom of another element, but the laws of physics say it happens all the time. Chemistry is a restricted subset of physics in order to simplify problems into a more solvable manner.

    Reflection is the physics in this case, where normal programming is the chemistry. It operates in a simpler mindset. Reflection allows you to circumvent that simpler set of rules, exposing you to new processes, but also new dangers.

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

Sidebar

Related Questions

So, I am learning Javascript while playing white Google Calendar APIs and I just
First of all i'm new in here and new with csharp. just exhausted while
I just saw this code while studying the wordpress source code (PHP), You can
While just playing with jQuery/JavaScript I ran across this problem. I could capture Alt
I was just playing with databases in C# 2010 Express and while typing 'using
i was just playing around with the ternary operator in my c class today.
While I have been playing with Python for a few months now (just a
I'm playing with some code for a blackjack program but I'm having trouble finding
i'm just playing around with Apple's CurrentAddress sample code and I was trying to
I am a newbie of node.js and everyauth. While I just playing around everyauth

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.