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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:09:10+00:00 2026-05-23T20:09:10+00:00

In C# 4, the behavior of types without the beforefieldinit flag was changed, so

  • 0

In C# 4, the behavior of types without the beforefieldinit flag was changed, so now a type initializer can call before first use of any static field of the class.

My questions are why has the C#/.NET team changed that behavior? What is the main reason? Can you show any practical example where this change makes any sense?

  • 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-23T20:09:10+00:00Added an answer on May 23, 2026 at 8:09 pm

    The behaviour has always been within the bounds of what’s documented – it’s just that it changed from being eager to lazy in .NET 4.

    I suspect the JIT team managed to find a way to make it lazy without a performance penalty… or possibly it helps performance somewhere else. This is likely to only be one such change in behaviour within the .NET 4 CLR vs the .NET 2 CLR… it happens that I noticed it, but I doubt that many other people did. I think it’s entirely reasonable for the JIT team to adjust things as they see fit, within the documented guarantees.

    Ultimately, if this makes your code fail, you’ve got a bug already.

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

Sidebar

Related Questions

I've created a factory assembly that can process any type of transaction (that supports
It seems I can call a function without prototype and definition of it in
The behavior I propose: A user loads up my search page, www.site.com/search, types their
The default behavior of XML serialization (to_xml) for ActiveRecord objects will emit 'type' and
The code below compiles, but has different behavior for the char type than for
Can you have smart behavior for the home key in Emacs? By smart I
I'm using Joomla jQuery Registration extension which comes without any kind of botcheck feature
For example, I have a contentEditable div and I can type in it. When
I encounter a totally strange behavior of the Java compiler. I can't cast a
I'm trying to tweak the behavior of the default IASKAppSettingsViewController so it can provide

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.