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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:50:49+00:00 2026-05-12T18:50:49+00:00

Given the example source code below, is it possible for someone to see the

  • 0

Given the example source code below, is it possible for someone to see the value of _secret using a disassembler? I didn’t see a way to get at the value via Reflector, but I haven’t used it very much. Assume the code is not obfuscated in any way.

class Foo
{
    private string _secret = @"all your base are belong to us";

    public void Foo()
    {
        ...
    }
}

Thanks!

  • 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-12T18:50:49+00:00Added an answer on May 12, 2026 at 6:50 pm

    It’s visible in the constructor in Reflector.

    class Foo { private string _secret = @"all your base are belong to us"; }
    

    translates to having constructor

    public Foo() { this._secret = "all your base are belong to us"; }
    

    which is visible in Reflector under Foo in method .ctor.

    You can also see this information in ildasm (ships with Microsoft Visual Studio) in Foo::.ctor : void:

    .method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
        // Code size       19 (0x13)
        .maxstack  8
        IL_0000:  ldarg.0
        IL_0001:  ldstr      "all your base are belong to us"
        IL_0006:  stfld      string Playground.Foo::_secret
        IL_000b:  ldarg.0
        IL_000c:  call       instance void [mscorlib]System.Object::.ctor()
        IL_0011:  nop
        IL_0012:  ret
    } // end of method Foo::.ctor
    

    Finally, if someone knows the name of your type and the name of your private field, you can obtain the value as such:

    object o = typeof(Foo).GetField(
        "_secret",
        BindingFlags.Instance | BindingFlags.NonPublic
    ).GetValue(f);
    Console.WriteLine(o); // writes "all your base are belong to us" to the console
    

    Of course, I can always see all of your private fields with

    var fields = typeof(Foo).GetFields(
        BindingFlags.Instance | BindingFlags.NonPublic
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the example below, can someone please show me how this could be called?
Given the code block below (source: http://www.asp.net/learn/mvc/tutorial-31-cs.aspx )... I receive this error: Using the
Ok, so I have a given video source (for the sake of the example,
When using downloaded R packages, such as tm, the given example usually loads an
The below code works fine to copy the files from Source to the Destination
Please answer with the shortest possible source code for a program that converts an
I see this [below] all over in the Android code (and some other code
i'm supposed to write code which when given a text file (source code) as
I am testing Devise with Rspec using Micheal Hartl source code (railstutorial) Whereas the
I'm trying to solve this problem : http://uva.onlinejudge.org/external/7/732.html . For the given example, they

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.