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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:53:55+00:00 2026-05-12T14:53:55+00:00

Well lets say we have this c# code: public override void Write(XDRDestination destination) {

  • 0

Well lets say we have this c# code:

public override void Write(XDRDestination destination)
{
    destination.WriteInt(intValue);
    destination.WriteBool(boolValue);
    destination.WriteFixedString(str1, 100);
    destination.WriteVariableString(str2, 100);
}

IL:

.method public hidebysig virtual instance void 
        Write(class [XDRFramework]XDRFramework.XDRDestination destination) cil managed
{
  // Code size       53 (0x35)
  .maxstack  8
  IL_0000:  ldarg.1
  IL_0001:  ldarg.0
  IL_0002:  call       instance int32 LearnIL.Test1::get_intValue()
  IL_0007:  callvirt   instance void [XDRFramework]XDRFramework.XDRDestination::WriteInt(int32)
  IL_000c:  ldarg.1
  IL_000d:  ldarg.0
  IL_000e:  call       instance bool LearnIL.Test1::get_boolValue()
  IL_0013:  callvirt   instance void [XDRFramework]XDRFramework.XDRDestination::WriteBool(bool)
  IL_0018:  ldarg.1
  IL_0019:  ldarg.0
  IL_001a:  call       instance string LearnIL.Test1::get_str1()
  IL_001f:  ldc.i4.s   100
  IL_0021:  callvirt   instance void [XDRFramework]XDRFramework.XDRDestination::WriteFixedString(string,
                                                                                                 uint32)
  IL_0026:  ldarg.1
  IL_0027:  ldarg.0
  IL_0028:  call       instance string LearnIL.Test1::get_str2()
  IL_002d:  ldc.i4.s   100
  IL_002f:  callvirt   instance void [XDRFramework]XDRFramework.XDRDestination::WriteVariableString(string,
                                                                                                    uint32)
  IL_0034:  ret
} // end of method Test1::Write

Now to the question my understanding is that ldarg.# puts the arguments supplied to the method on the stack so we can work with them?
But why does it call ldarg.1 and ldarg.0 when the method only takes one argument?

  • 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-12T14:53:55+00:00Added an answer on May 12, 2026 at 2:53 pm

    Instance methods have an implicit parameter (this) that is passed as the first argument of every instance method. The instruction ldarg.0 is loading this onto the stack. The instruction ldarg.1 is the loading the first real (explicit) argument.

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

Sidebar

Ask A Question

Stats

  • Questions 313k
  • Answers 313k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You must call a DataBind method. In this case, add… May 13, 2026 at 10:54 pm
  • Editorial Team
    Editorial Team added an answer The fastest App Store approved way to do CPU-only 2D… May 13, 2026 at 10:54 pm
  • Editorial Team
    Editorial Team added an answer You can do something like this, if thats your concern,… May 13, 2026 at 10:54 pm

Related Questions

Got some C# forms/controls that can be called up either from a C# control
Let’s say that I have two C# applications - game.exe (XNA, needs to support
Sorry for the lack of a descriptive title; I couldn't think of anything better.
Ladies and Gents, My best friends and I do a Secret Santa type gift

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.