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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:14:58+00:00 2026-05-20T08:14:58+00:00

I wonder why string literals are all documented in an assembly’s manifest (under the

  • 0

I wonder why string literals are all documented in an assembly’s manifest (under the User Strings token)?

It seems a bit redundant, considering that the string literal is also in the CIL directly, i.e. this C# code:

public void PrintMessage()
{
    string myMessage = "Hello.";
    Console.WriteLine(myMessage);
}

compiles to this CIL

. method public hidebysig instance void PrintMessage() cil managed
{ 
    .maxstack  1
    // Define a local string variable (at index 0).
    .locals init ([0] string myMessage)
    // Load a string on to the stack with the value "Hello."
    ldstr  " Hello. "
    // Store string value on the stack in the local variable.
    stloc. 0
    // Load the value at index 0.
    ldloc. 0
    // Call method with current value.
    call  void [mscorlib]System.Console: :WriteLine(string)
    ret
}

That string literal also will be recorded in the assembly’s manifest with something like this (as seen through ildasm):

**User Strings**
-------------------------------------------------------
70000001 : (11) L"Hello."

So why is the string literal in both places? What purpose does it serve?

P.S. this code is all courtesy of Pro C# 2008 and the .NET Platform

  • 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-20T08:14:59+00:00Added an answer on May 20, 2026 at 8:14 am

    Well, you’re seeing it twice – but I would expect that the ldstr instruction just referenced a string from the string tables. It’s being shown in the ildasm because it would be pretty tedious to just say “user string 7” etc.

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

Sidebar

Related Questions

I wonder how to get a string (or array of strings) between two known
I wonder, how can I increment a string representing a binary number, all the
I wonder how can i remove all string part after #. For example if
I wonder if someone could help me figure out how to parse a string
I wonder if there is a way of concating two strings in Silverlight inside
I wonder if the flash.utils.getDefinitionByName(name:String):Class works with custom classes? Is there a problem if
Just wonder how to convert a unicode string like u'é' to its unicode character
I wonder if it's reliable to use a construction like: private static final Map<String,
I have string like this first#second, and I wonder how to get second part
Just wonder if a literal string is an lvalue or an rvalue. Are other

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.