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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:03:23+00:00 2026-06-13T17:03:23+00:00

In .NET, there is a class called System.Text.Encoding in mscorlib . But when you

  • 0

In .NET, there is a class called System.Text.Encoding in mscorlib. But when you do System.Text.Encoding.ASCII, you can access the ASCII encoding class.

At first, I thiught this was a class in a class kind of thing:

class Encoding {
    class ASCII { ... }
    ...
}

But what is confusing is that you can also use System.Text.ASCIIEncoding to access the same functions.

Not being able to decompile .NET (as .NET Reflector costs money and I don’t understand IL that well [so no ildasm]), I can’t wrap my head around how the two classes are equal. Could it be something like this?

class ASCIIEncoding {
    internal ASCIIEncoding() { ... }
    /* static functions */
}
static class Encoding {
    public static readonly ASCIIEncoding ASCII = new ASCIIEncoding();
    ...
}

This seems like the most likely way, but the function prototype is

public static Encoding ASCII { get; }

Returning a class deriviated from Encoding doesn’t make sense as Encoding is a class with the Encoding types (ASCII, UTF-(7/8/16/32), etc.), so that means that ASCIIEncoding would need those variables also, no?

Can anyone help clear up this confusion?

  • 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-06-13T17:03:24+00:00Added an answer on June 13, 2026 at 5:03 pm

    Returning a class deriviated from Encoding doesn’t make sense as Encoding is a class with the Encoding types (ASCII, UTF-(7/8/16/32), etc.), so that means that ASCIIEncoding would need those variables also, no?

    No, because Encoding.ASCII etc are static properties, presumably backed by static fields (although that’s an implementation detail – the property could just create a new instance each time, or there could be a static internal field within ASCIIEncoding which it uses, etc).

    It’s just like this:

    public class BaseClass
    {
        private readonly static BaseClass firstDerived = new FirstDerived();
        private readonly static BaseClass secondDerived = new SecondDerived();
    
        public static BaseClass First
        { 
            get { return firstDerived; } 
        }
    
        public static BaseClass Second
        { 
            get { return secondDerived; } 
        }
    }
    
    public class FirstDerived : BaseClass {}
    public class SecondDerived : BaseClass {}
    

    That’s complete code – albeit useless in terms of the derived classes actually doing anything. Make sure you understand every bit of how that works, and then just apply it to Encoding…

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

Sidebar

Related Questions

Is there a class in the .NET BCL that can store a block of
I'd like to know if there's any way to force the System.Net.Dns class to
I know there is a class system.data.sqlclient.sqlcommand that can execute a batch at a
In VB.NET there is a keyword 'shadows'. Let's say I have a base class
Is there a class in the ASP.NET MVC framework that represents a controller name
Is there a class or set of functions built into the .NET Framework (3.5+)
Is there a way in .NET to have a class property have a second
Is there an equivalent of the .NET ManualResetEvent class available for use in Objective-C
The documentation for the .NET Semaphore class states that: There is no guaranteed order,
I am using the .NET XmlSerializer class to deserialize GPX files. There are two

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.