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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:31:01+00:00 2026-05-24T13:31:01+00:00

Looking at the difference between the stfld and stsfld il op codes, the stfld

  • 0

Looking at the difference between the stfld and stsfld il op codes, the stfld has a null reference check while stsfld does not. Why is this? Is it because static fields are on the high-frequency heap and so they are not garbage collected?

http://msdn.microsoft.com/library/system.reflection.emit.opcodes.stfld.aspx

The stack transitional behavior, in sequential order, is:

  1. An object reference or pointer is pushed onto the stack.
  2. A value is pushed onto the stack.
  3. The value and the object reference/pointer are popped from the
    stack; the value of field in the object is replaced with the supplied
    value.

The stfld instruction replaces the value of a field of an object (type
O) or via a pointer (type native int, &, or *) with a given value.
Field is a metadata token that refers to a field member reference. The
stfld instruction can have a prefix of either or both of Unaligned and
Volatile.

NullReferenceException is thrown if the object reference or pointer is
a null reference and the field isn’t static.

MissingFieldException is thrown if field is not found in the metadata.
This is typically checked when the Microsoft Intermediate Language
(MSIL) instruction is converted to native code, not at runtime.

  • 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-24T13:31:02+00:00Added an answer on May 24, 2026 at 1:31 pm

    Static members never have a target instance. If there are parameters (on a method), arg0 refers to the first parameter, not the target instance (aka this). Since there is no target-instance, a null check is meaningless: there is nothing to dereference.

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

Sidebar

Related Questions

What is the difference between 'a and '_l ? I was looking at this
Is there any difference between uint and unsigned int ? I'm looking in this
I was looking at Stack Overflow question What is the difference between abstract function
I'm just looking for a simple, concise explanation of the difference between these two.
At first I was just looking for the difference between Resource and Embedded Resource;
What is the difference between a Relay Controller and a Microcontroller ? I'm looking
I'm looking for a way to determine the difference between two dates. A normal
I'm looking at namespaces and I don't really see a difference between these and
I can't work out from looking through the source what the difference is between
Overview I'm looking to analyse the difference between two characters as part of a

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.