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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:17:27+00:00 2026-05-12T23:17:27+00:00

I used reflection many times before on public methods, but I never realized that

  • 0

I used reflection many times before on public methods, but I never realized that private methods can be invoked too. See Reflection with private members.

Why is that allowed in the first place? Isn’t that going to break the rule of “private” being “private”?

  • 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-12T23:17:27+00:00Added an answer on May 12, 2026 at 11:17 pm

    private in C# is truly only part of the language specification; in the C# language, as well as in the Visual Basic language or any other sensible .NET language (including CIL, what all the .NET languages compile to) one is prevented from accessing a private (or protected, if you’re not within a derived class) member in the language. However, just because the language doesn’t support publicly accessing private or protected members doesn’t mean the underlying framework can’t provide access to those members.

    This is one of those cases where one typically shouldn’t be using workarounds like reflection to access or modify private or protected members, but the framework allows one to anyway. Generally, you should have a very good reason to access private or protected members; one such reason, for example, is implementing a serializer that needs to look at the object’s internal state to properly serialize the object. If you’re not doing something like that, you should truly look at reimplementing the class you’re poking around inside, so that you don’t need to use reflection in your program.

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

Sidebar

Related Questions

Never used a cache like this before. The problem is that I want to
I've never really used reflection before and am attempting something I'm not sure is
Many Java frameworks allow class members used for injection to be declared non-public. For
We have two classes that have the exact same public accessors (and many of
I'm sure many readers on SO have used Lutz Roeder 's .NET reflector to
When used like this: import static com.showboy.Myclass; public class Anotherclass{} what's the difference between
We used to use SourceSafe, and one thing I liked about it was that
I'm writing a c# program that will launch many child processes. At some time
Does anyone knows how can I invoke method dynamically without reflection? I`ll try to
I notice in several API's, that you may create a struct which is used

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.