<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: sadık emre</title>
    <description>The latest articles on DEV Community by sadık emre (@csadikemre).</description>
    <link>https://dev.to/csadikemre</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4034364%2F7e9fec00-164b-48d5-b500-c93ff609a1f6.png</url>
      <title>DEV Community: sadık emre</title>
      <link>https://dev.to/csadikemre</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/csadikemre"/>
    <language>en</language>
    <item>
      <title>About VPN: Questions and Answers</title>
      <dc:creator>sadık emre</dc:creator>
      <pubDate>Sun, 23 Aug 2026 11:13:57 +0000</pubDate>
      <link>https://dev.to/csadikemre/about-vpn-questions-and-answers-1k7c</link>
      <guid>https://dev.to/csadikemre/about-vpn-questions-and-answers-1k7c</guid>
      <description>&lt;h2&gt;
  
  
  PART 1: Connecting to a Company VPN
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. What is a VPN, what is its basic purpose?
&lt;/h2&gt;

&lt;p&gt;A VPN (Virtual Private Network) is a system that encrypts the traffic leaving your device and carries it, inside a private "tunnel," over your existing internet connection to another point (the VPN server). The purpose is to hide your traffic from eyes on the local network and the ISP, and/or to connect to a remote private network (such as a company network).&lt;/p&gt;

&lt;p&gt;This definition contains a few terms. We'll cover each of them in detail in later sections, but let's first define them all briefly in one place. That way the terminology won't be confusing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common basic terms:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Encryption&lt;/strong&gt;: Turning data into a form that no one without the right key can read.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Encapsulation&lt;/strong&gt;: Adding a new address label to the outside of encrypted data, showing where it should go.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tunnel / Tunneling&lt;/strong&gt;: The method that results from applying encapsulation and encryption to every packet, consistently and systematically, throughout a connection. "Tunnel" is the name of the virtual connection set up this way.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPN client&lt;/strong&gt;: The VPN app you install on your device, which does the encryption and encapsulation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPN server&lt;/strong&gt;: The computer at the other end of the tunnel that decrypts the data and forwards it to the real destination.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private IP (internal IP)&lt;/strong&gt;: An address that's only valid inside a specific private network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public IP (external IP)&lt;/strong&gt;: The address visible on the internet, given by your ISP.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ISP&lt;/strong&gt;: The company that provides your internet connection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT&lt;/strong&gt;: The router hiding internal IPs behind the public IP.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Packet / IP packet&lt;/strong&gt;: The unit of data carried on a network, which carries address information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Split tunnel / Full tunnel&lt;/strong&gt;: Whether only certain traffic, or all traffic leaving the device, goes through the tunnel.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. When you connect to a company VPN, what path does a data packet follow?
&lt;/h2&gt;

&lt;p&gt;Device&lt;/p&gt;

&lt;p&gt;→ VPN client: the VPN app installed on your computer (encrypts and wraps the data)&lt;/p&gt;

&lt;p&gt;→ Internet (encrypted tunnel)&lt;/p&gt;

&lt;p&gt;→ VPN server: the computer run remotely by the company or the provider you use (decrypts the data, forwards it to the real destination)&lt;/p&gt;

&lt;p&gt;→ Destination server: a service/database inside the company&lt;/p&gt;

&lt;p&gt;→ the response comes back the same way&lt;/p&gt;

&lt;h2&gt;
  
  
  3. How does encapsulation happen?
&lt;/h2&gt;

&lt;p&gt;Imagine you're writing "Hi" to a friend. Both of these steps are done &lt;strong&gt;by the VPN app installed on your computer&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Encryption&lt;/strong&gt;: The VPN app turns the word "Hi" into something meaningless (example: &lt;code&gt;X7!ap4b#tr&lt;/code&gt;), which only the VPN server can decode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Putting it in a new envelope&lt;/strong&gt;: The VPN app then adds a new, readable address label around this encrypted data: &lt;code&gt;[From: your public IP | To: VPN server] X7!ap4b#tr&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of it like an envelope in the mail: the address on the outside can be read by the postal service (the routers), but the letter inside is sealed, and only the recipient (the VPN server) can open it.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Does encryption happen on the device, and is that how the data leaves for the internet?
&lt;/h2&gt;

&lt;p&gt;Yes. Here's the order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Encryption and wrapping happen &lt;strong&gt;on your computer&lt;/strong&gt;, done by the VPN app, before the data leaves for the internet.&lt;/li&gt;
&lt;li&gt;The finished packet (readable outer address, encrypted inner part) goes to your home router (modem).&lt;/li&gt;
&lt;li&gt;The router sends it to the ISP.&lt;/li&gt;
&lt;li&gt;The ISP only looks at the outer (unencrypted) address and forwards it; it can't read the content.&lt;/li&gt;
&lt;li&gt;The packet reaches the VPN server, where it gets decrypted.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It always passes through the ISP before reaching the VPN server.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. When the VPN assigns a private IP, how do authentication and joining the network work?
&lt;/h2&gt;

&lt;p&gt;There are two stages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 1: Authentication.&lt;/strong&gt; The VPN server has a public IP address. You connect to it &lt;strong&gt;using your own real public IP&lt;/strong&gt;; since you don't have a private IP yet, there's no other way to connect. You prove your identity through methods like a password or a certificate. Some systems also add extra security, such as a rule that only accepts connections from certain public IPs, but the actual authentication is done with a password or certificate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 2: Joining the network.&lt;/strong&gt; Once your identity is confirmed, you're given a private IP (like 10.8.0.15). Since the company's other servers are also part of the same private network (10.x.x.x), you can reach each other using these private IPs. The VPN server acts as the bridge/gateway between you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can the destination server see your public IP?&lt;/strong&gt; No, it only sees your private IP (10.8.0.15). The VPN server doesn't change the source address when it forwards the packet. The destination server may also have a firewall rule in front of it, such as "only accept requests coming from the VPN's private IP range." This is a separate, extra layer of security on top of authentication.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. What happens when you access an address that doesn't belong to the company (like YouTube) while connected to the VPN?
&lt;/h2&gt;

&lt;p&gt;This depends on whether the VPN is running in split tunnel or full tunnel mode (see 2.3).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Split tunnel (common, default behavior):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Only traffic going to the company's private network goes through the tunnel.&lt;/p&gt;

&lt;p&gt;General internet destinations like YouTube never enter the tunnel; they go out directly through your normal internet connection.&lt;/p&gt;

&lt;p&gt;Result: you go out with two different IPs at the same time. Company traffic goes through the VPN, and everything else goes through your own connection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Full tunnel (some companies enforce this):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;All traffic, including YouTube, first goes to the VPN server, then goes back out to the internet from there.&lt;/p&gt;

&lt;p&gt;Result: everywhere you go sees you as if you're coming from the VPN server.&lt;/p&gt;

&lt;p&gt;In both modes, your actual internet connection never changes. What changes is where your traffic exits from in the last step.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. At which stages does a VPN provide security, and where doesn't it?
&lt;/h2&gt;

&lt;p&gt;The path:&lt;/p&gt;

&lt;p&gt;Device&lt;/p&gt;

&lt;p&gt;→ Local network (your home/office WiFi) + ISP&lt;/p&gt;

&lt;p&gt;→ VPN server&lt;/p&gt;

&lt;p&gt;→ Destination server&lt;/p&gt;

&lt;p&gt;The VPN protects the path from your device to the VPN server. It hides you from eyes on the local network (other devices on the same WiFi) and at the ISP.&lt;/p&gt;

&lt;p&gt;But protection ends between the VPN server and the destination site. That part is the open internet.&lt;/p&gt;

&lt;p&gt;If the site uses HTTPS, that part is protected by its own TLS encryption (a separate mechanism, independent of the VPN). If it uses HTTP, it's completely open.&lt;/p&gt;

&lt;p&gt;Also, the VPN server itself can see your traffic, because it has to decrypt it in order to forward it. So using a VPN doesn't mean "no one can see this"; it means "the local network and the ISP can't see it, but my VPN provider can."&lt;/p&gt;

&lt;p&gt;Note: if the tunnel drops unexpectedly, there's a feature that stops your traffic from silently continuing without encryption. This is called a &lt;strong&gt;kill switch&lt;/strong&gt; (see 3.5).&lt;/p&gt;

&lt;h2&gt;
  
  
  PART 2: Details (Explanations That Complete the Basic Mechanics)
&lt;/h2&gt;

&lt;h2&gt;
  
  
  2.1 Terms and Concepts
&lt;/h2&gt;

&lt;p&gt;In Part 1 we touched on a few terms in passing. Let's explain them here.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is the VPN concerned with the NAT/private IP setup on your home network, or does it create its own network?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Private IP&lt;/strong&gt;: The address the router gives to devices on the local network (like 192.168.x.x). Only meaningful inside that local network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public IP&lt;/strong&gt;: The address your ISP gives you, visible on the internet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The router hides the private IP behind the public IP. This is called &lt;strong&gt;NAT&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The VPN has nothing to do with this NAT/private IP setup on your home network, and doesn't touch it.&lt;/strong&gt; Whether or not you connect to the VPN, your private IP on the home network stays the same.&lt;/p&gt;

&lt;p&gt;What the VPN actually cares about is something else entirely: it sets up &lt;strong&gt;its own separate network&lt;/strong&gt;, and assigns you a private IP &lt;strong&gt;that it gives you&lt;/strong&gt; on that network (like 10.8.0.15). This is a brand-new network specific to the VPN, independent of the NAT on your home network.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is an ISP?
&lt;/h3&gt;

&lt;p&gt;Internet Service Provider: a company like Türk Telekom or Vodafone that gives you internet access and a public IP.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where does the term "tunneling" come from, and why is it confused with encryption?
&lt;/h3&gt;

&lt;p&gt;The name comes from a tunnel that goes through a mountain: vehicles enter from one end and exit from the other, and while inside, they're invisible from the outside. So the name means "opening a private path through a public network, without mixing into it." It's not directly related to encryption. In fact, some old tunneling protocols (like GRE) don't do any encryption at all.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why can't I see my public IP from the command line (cmd)?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ipconfig&lt;/code&gt; only shows the local settings your device knows about; it doesn't show your public IP. But if you use a command that sends a request out and waits for a reply, like &lt;code&gt;curl ifconfig.me&lt;/code&gt;, you can find it out.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.2 Network Layers
&lt;/h2&gt;

&lt;p&gt;Encapsulation (Part 1, item 3) is actually a general principle of networks applied to VPNs. This principle is called a "layer."&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does the concept of a layer exist, and where does the name come from?
&lt;/h3&gt;

&lt;p&gt;Network communication is split into independent tasks stacked on top of each other. Each layer does its own job and relies on the layer below it. They're called "layers" because they're stacked like layers of a cake. The benefit: you can change one layer (like WiFi instead of fiber) without affecting the others.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are the network layers?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Physical layer&lt;/strong&gt;: carries raw bits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data link layer&lt;/strong&gt;: connects devices on the local network using MAC addresses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network layer (IP)&lt;/strong&gt;: routes between different networks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transport layer (TCP/UDP)&lt;/strong&gt;: separates applications using port numbers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application layer&lt;/strong&gt;: the actual data, like HTTP, DNS, TLS.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How do the layers work independently of each other?
&lt;/h3&gt;

&lt;p&gt;Like mail: letter (data) → envelope (port) → box (IP) → courier routing (MAC) → physical transport. The courier doesn't read the letter; they only look at the label for their own layer. So if one layer changes (a truck instead of a plane), the layers above it aren't affected.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is an IP packet, how is it different from a data packet?
&lt;/h3&gt;

&lt;p&gt;"Packet" is the name for the envelope at whichever layer you're talking about. An "IP packet" is specifically the envelope that has an IP address written on it. It's not a separate thing; it's a member of the same family.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.3 Inside Tunneling
&lt;/h2&gt;

&lt;p&gt;Now let's look at how a VPN uses these layers, and whether encapsulation has a size limit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does every packet go through encapsulation?
&lt;/h3&gt;

&lt;p&gt;No. When the VPN connects, a rule is added to the operating system: "A packet going to the company network → send it through the tunnel, encapsulated. Everything else → send it the normal way." (See Part 1, item 6: split tunnel.)&lt;/p&gt;

&lt;h3&gt;
  
  
  Is there a size limit on encapsulation?
&lt;/h3&gt;

&lt;p&gt;Yes. A network connection can carry only a certain amount of data at once. This is called the &lt;strong&gt;MTU&lt;/strong&gt;; on Ethernet, this is usually 1500 bytes.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does the header added by the VPN cause some websites to fail to load?
&lt;/h3&gt;

&lt;p&gt;If a packet is already close to 1500 bytes, the extra header added by the VPN (about 30-60 bytes) pushes the total over that limit. As a result, the packet either gets split in two (many firewalls block this) or a warning message gets stuck at a firewall, and the connection hangs for no obvious reason.&lt;/p&gt;

&lt;p&gt;Small requests (text, DNS) aren't affected; larger content (video, images) gets stuck. The fix: the VPN sets the tunnel interface's MTU lower from the start (like 1400), so packets are already produced smaller.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.4 How Does a VPN Get Between the Layers?
&lt;/h2&gt;

&lt;p&gt;So how does the VPN software actually become part of this layer system?&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a virtual network interface?
&lt;/h3&gt;

&lt;p&gt;An interface is the point where two systems meet, like an electrical outlet. It's normally something physical (like a WiFi chip), but software can create a fake one; the operating system treats it as real.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does the VPN create this interface? Is it interfering with the system without permission?
&lt;/h3&gt;

&lt;p&gt;Operating systems leave an official door open for exactly this purpose: &lt;strong&gt;TUN/TAP&lt;/strong&gt;. With admin permission, the VPN uses this door and says "I'm an interface too." The operating system doesn't care which card it's using.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is TUN/TAP?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;TUN&lt;/strong&gt; only carries IP packets (most VPNs use this). &lt;strong&gt;TAP&lt;/strong&gt; behaves like a full Ethernet card, and is used to merge two networks so they act like one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Doesn't this require serious system-level permission?
&lt;/h3&gt;

&lt;p&gt;Yes. That's why installing a VPN asks for admin rights. Legitimate software like antivirus programs and firewalls use the same mechanism, but which VPN you trust matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.5 Types of VPN
&lt;/h2&gt;

&lt;p&gt;These different layers and mechanisms translate, in practice, into different types of VPN.&lt;/p&gt;

&lt;h3&gt;
  
  
  How are VPN types classified by purpose?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Remote access VPN&lt;/strong&gt;: A single user connects to a company network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Site-to-site VPN&lt;/strong&gt;: Two office networks connect to each other.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Personal/commercial VPN&lt;/strong&gt; (like NordVPN): Connects you to the provider's own server.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What is an IPsec VPN?
&lt;/h3&gt;

&lt;p&gt;IPsec (Internet Protocol Security) is a family of encryption and authentication protocols that works at the network layer (IP level). It creates a tunnel interface on the device (see 2.4) and encrypts &lt;strong&gt;all traffic&lt;/strong&gt; leaving that device, no matter which app or port, sending it through the tunnel. Because of this, a separate VPN client app usually needs to be installed. It's one of the most common approaches used in company VPNs (Part 1).&lt;/p&gt;

&lt;h3&gt;
  
  
  What is an SSL VPN?
&lt;/h3&gt;

&lt;p&gt;An SSL VPN gets its name from TLS/SSL encryption, meaning it uses the same mechanism that's behind HTTPS. Unlike IPsec, it works higher up, at the application level, instead of the network layer. This makes it more selective: it can tunnel a specific app or web-based service instead of all the traffic on the device. Some SSL VPNs can even provide access directly through a browser ("clientless"), without installing a separate program.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are modern alternatives to traditional VPNs?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mesh VPN&lt;/strong&gt; (like Tailscale, ZeroTier): In a classic VPN, traffic always goes through a central server. In a mesh VPN, the central server just helps devices find each other (see 3.4); the actual traffic flows directly between devices. It's quick to set up, and is generally preferred by small teams for secure access to their own servers (see 2.6).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ZTNA (Zero Trust Network Access) / SASE&lt;/strong&gt;: In a classic VPN, once you're in the tunnel, you have access to most of the network; a single compromised account can put the whole network at risk. ZTNA instead verifies every request separately; the user can only reach the specific app they're authorized for, and never sees the rest of the network. SASE turns this approach into a security/network service package delivered through the cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.6 Peer-to-Peer Tunnel
&lt;/h2&gt;

&lt;p&gt;Up to this point, there was always a central VPN server. In peer-to-peer, that goes away.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a peer-to-peer tunnel?
&lt;/h3&gt;

&lt;p&gt;Think of an old-style phone switchboard: normally the switchboard (the VPN server) sits in the middle of every conversation. In peer-to-peer, the switchboard just introduces the two sides, then steps out, and the devices talk directly.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's the security difference compared to a centralized system?
&lt;/h3&gt;

&lt;p&gt;In a centralized system, if the server is compromised, everything can be read. In peer-to-peer, the helper server never sees the encryption, so even if it's compromised, the traffic can't be read.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are the benefits of setting up a personal mesh network?
&lt;/h3&gt;

&lt;p&gt;With tools like Tailscale/ZeroTier, you can connect to each other using private IPs and set up a secure network that's closed off from the outside. If you want, you can turn one device into an "exit node" and go out to the internet through it as well. (See 3.4 for the technical details of how two devices find each other.)&lt;/p&gt;

&lt;h2&gt;
  
  
  2.7 DNS and DNS Leaks
&lt;/h2&gt;

&lt;p&gt;A VPN doesn't just affect IP traffic; it also affects domain name lookups.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a DNS server?
&lt;/h3&gt;

&lt;p&gt;A server that translates a domain name (example.com) into an IP address.&lt;/p&gt;

&lt;h3&gt;
  
  
  How are DNS queries normally handled while connected to a VPN?
&lt;/h3&gt;

&lt;p&gt;When the VPN is working correctly, your DNS queries go through the encrypted tunnel, like the rest of your traffic, to the VPN provider's own DNS server. So even the question "what site do I want to go to" stays inside the tunnel, in a way the ISP can't see.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does a DNS leak happen while using a VPN?
&lt;/h3&gt;

&lt;p&gt;If the VPN fails to route these queries to its own server, the device still asks the old (ISP) DNS server. These queries go out unencrypted, outside the tunnel. This means which sites you visit ends up leaking to the ISP.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.8 Censorship and Obfuscation
&lt;/h2&gt;

&lt;p&gt;Finally, let's look at whether a VPN itself can be blocked.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can VPN access be blocked at the state level?
&lt;/h3&gt;

&lt;p&gt;Yes. Known VPN server IPs can be blocked, or DPI can be used to recognize the "pattern" of the traffic and stop it.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is DPI (Deep Packet Inspection)?
&lt;/h3&gt;

&lt;p&gt;DPI is when a network device tries to figure out what kind of connection is passing through, not just by looking at the destination address, but by looking at the general "behavior" of the packet (its size, timing, handshake pattern, and so on). It can't read the content because it's encrypted, but it can guess "this looks like a VPN handshake" and block the traffic.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is obfuscation?
&lt;/h3&gt;

&lt;p&gt;Dressing up a VPN packet to look like normal HTTPS traffic. DPI mistakes it for an ordinary website visit.&lt;/p&gt;

&lt;h2&gt;
  
  
  PART 3: Advanced Topics
&lt;/h2&gt;

&lt;p&gt;This section briefly rounds out the picture with more intermediate-to-advanced, practical and architectural topics, after you've learned the basic mechanics.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.1 Comparing VPN, Proxy, and Tor
&lt;/h2&gt;

&lt;p&gt;All three are often confused with each other, but they work at different layers and with different trust models.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a proxy, what is it used for?
&lt;/h3&gt;

&lt;p&gt;A proxy is a simple middleman that forwards your requests through another server on your behalf. It's usually specific to a single app (mostly the browser) and doesn't encrypt traffic. Its purpose isn't privacy; it's mostly just to change your IP/location. It's typically used for simple scenarios, like getting around a regional content restriction.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Tor, what is it used for?
&lt;/h3&gt;

&lt;p&gt;Tor (The Onion Router) is a network that routes your traffic through three randomly chosen volunteer servers, encrypting each layer separately. Its purpose is maximum anonymity: it's used in scenarios where hiding your identity is critical, such as journalism, avoiding censorship, or sensitive research. The cost is a noticeable slowdown, because it passes through three servers.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Proxy&lt;/th&gt;
&lt;th&gt;VPN&lt;/th&gt;
&lt;th&gt;Tor&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Scope&lt;/td&gt;
&lt;td&gt;Usually a single app&lt;/td&gt;
&lt;td&gt;OS-level, all traffic&lt;/td&gt;
&lt;td&gt;Usually the browser&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Encryption&lt;/td&gt;
&lt;td&gt;Mostly none&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes, three layers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Point of trust&lt;/td&gt;
&lt;td&gt;Proxy provider&lt;/td&gt;
&lt;td&gt;VPN provider&lt;/td&gt;
&lt;td&gt;No single node knows both source and destination&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Speed&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Slow&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A proxy only changes your IP; it doesn't encrypt.&lt;/p&gt;

&lt;p&gt;A VPN encrypts all your traffic and routes it through a single server.&lt;/p&gt;

&lt;p&gt;Tor routes traffic through three different servers; the entry node knows who you are but not the destination, and the exit node knows the destination but not who you are.&lt;/p&gt;

&lt;p&gt;Tor is the most private option, but also the slowest.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.2 Performance Differences Between Protocols
&lt;/h2&gt;

&lt;p&gt;In the context of a VPN, a &lt;strong&gt;protocol&lt;/strong&gt; is a shared set of rules that both sides (your device and the VPN server) agree on in advance, about how to set up the tunnel, how the data will be encrypted, and how packets will be encapsulated. In other words, a protocol is "the actual method/technology that does the tunneling"; a VPN can only work through a protocol it has chosen.&lt;/p&gt;

&lt;p&gt;Why is a protocol needed at all? Because two different devices, your computer and the VPN server, possibly with different operating systems and hardware, need a shared "language" and a fixed sequence to talk to each other without issues: how they'll introduce themselves, how they'll exchange keys, what format they'll package the data in, and so on. These rules make different vendors' VPN software compatible with each other not because they aren't standardized, but precisely &lt;strong&gt;because they are standardized&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let's first get familiar with the common VPN protocols:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PPTP&lt;/strong&gt;: One of the oldest VPN protocols. It's simple to set up, but its security is considered weak by today's standards, so it shouldn't be used anymore.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;L2TP/IPsec&lt;/strong&gt;: L2TP sets up the tunnel structure, and IPsec provides the actual encryption. The two are usually used together.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IKEv2/IPsec&lt;/strong&gt;: Especially common on mobile devices. It can keep the connection alive without dropping it when the network changes (for example, switching from WiFi to mobile data).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenVPN&lt;/strong&gt;: An open-source protocol based on TLS/SSL. It's been one of the most widely used options for a long time, with broad device and operating system support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WireGuard&lt;/strong&gt;: A newer, open-source protocol with a small, simple codebase. It stands out for both speed and simplicity, and is preferred by many VPN apps today.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why are some VPN protocols faster than others?
&lt;/h3&gt;

&lt;p&gt;There are a few reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Codebase size&lt;/strong&gt;: a small codebase runs faster and is easier to audit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Where it runs&lt;/strong&gt;: protocols that run in the operating system kernel have less delay than ones that run in user space (no extra handoff layer needed for each packet).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Encryption algorithm&lt;/strong&gt;: some algorithms (like AES) benefit from hardware acceleration circuits on modern CPUs (AES-NI); others (like ChaCha20) are designed to run fast in software even without hardware acceleration. Which one is faster depends on the hardware being used.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Number of handshake steps&lt;/strong&gt;: a handshake with fewer steps lets the connection re-establish faster, especially when the network changes (like switching from WiFi to mobile data).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3.3 Advanced Encryption Concepts
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is Perfect Forward Secrecy (PFS)?
&lt;/h3&gt;

&lt;p&gt;Let's first recall two concepts. A &lt;strong&gt;key&lt;/strong&gt; is a usually long, random sequence of numbers used to encrypt/decrypt data; someone without the right key can't read the encrypted data. &lt;strong&gt;Key exchange&lt;/strong&gt; is the process where the two sides (the device and the VPN server) securely agree on this shared secret key; this happens right when the connection is being set up, just before the tunnel opens.&lt;/p&gt;

&lt;p&gt;If the shared key produced during key exchange always stayed the same, it being compromised later would expose all past traffic. &lt;strong&gt;PFS&lt;/strong&gt; ensures that a new, temporary key is generated for every session. This way, if a key is compromised, it only affects a short period, and past records stay safe.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are certificates and PKI (Public Key Infrastructure)?
&lt;/h3&gt;

&lt;p&gt;A certificate is a digital document, signed by a &lt;strong&gt;CA&lt;/strong&gt; (Certificate Authority), that says "this public key really belongs to this server." &lt;strong&gt;Mutual TLS (mTLS)&lt;/strong&gt;: not just the server, but the client also presents its own certificate, so both sides prove who they are to each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.4 NAT Traversal: How a Peer-to-Peer Connection Gets Established
&lt;/h2&gt;

&lt;h3&gt;
  
  
  How do two devices find each other and connect directly?
&lt;/h3&gt;

&lt;p&gt;This is called "hole punching." The process involves three different components; two are servers, and one is a method/algorithm.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;STUN server&lt;/strong&gt;: A server computer running on the internet, with a fairly simple job. A device connects to it and asks, "what IP and port do you see me as from the outside?" and STUN answers. This is how a device learns how it appears from outside its own router. This is information the device normally couldn't know on its own.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ICE (Interactive Connectivity Establishment)&lt;/strong&gt;: Not a server. It's a method that both devices run on their own side. It tries several possible connection paths, including the addresses learned from STUN, one by one, and picks whichever one actually works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TURN server&lt;/strong&gt;: A server that runs on the internet, like STUN, but with a different job. When a direct connection can't be made between two devices, it relays the data itself, through its own connection. Think of it like a post office: a middleman that steps in and carries the letter when it can't be delivered directly. In this case, the connection is no longer truly peer-to-peer, because the TURN server can see the traffic. It's used as a last resort, when other methods don't work.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.5 Kill Switch
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is a kill switch, and why does it matter?
&lt;/h3&gt;

&lt;p&gt;If the tunnel drops suddenly, the operating system usually keeps going without the VPN, silently. This means unencrypted traffic can leak without you noticing. A &lt;strong&gt;kill switch&lt;/strong&gt; stops all traffic the moment the tunnel drops; no packet goes out until the tunnel is re-established.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.6 IPv6 Leaks
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is an IPv6 leak?
&lt;/h3&gt;

&lt;p&gt;Most VPNs only route IPv4 traffic through the tunnel, and can forget about IPv6. If IPv6 is enabled on the device, this traffic can go out unencrypted, outside the tunnel. The fix: have the VPN route IPv6 through the tunnel as well, or turn IPv6 off on the system.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.7 VPN Detection and Chaining
&lt;/h2&gt;

&lt;h3&gt;
  
  
  How do services like Netflix detect users who are using a VPN?
&lt;/h3&gt;

&lt;p&gt;Through signs like lists of known VPN provider IPs, a large number of accounts connecting from the same IP, and the IP being in a "datacenter" range instead of a home/mobile one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a datacenter?&lt;/strong&gt; It's a range of IPs belonging to hosting/cloud companies that host servers in data centers, rather than to home/mobile users. A regular home user's IP comes from a range that belongs to an ISP; since VPN servers usually run from this kind of data center IP, a connection coming from a "datacenter" range is a strong sign that a VPN is being used.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Double VPN (VPN chaining)?
&lt;/h3&gt;

&lt;p&gt;Traffic passing through two VPN servers, one after the other. Benefit: compromising a single server isn't enough. Cost: latency increases significantly.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.8 VPN at Cloud and Enterprise Scale
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is Cloud VPN, how is it different from VPC peering?
&lt;/h3&gt;

&lt;p&gt;Cloud VPN is a method for connecting a company's own physical office or data center network to a cloud provider's virtual network (VPC/VNet), such as AWS or Azure. The logic is the same as the site-to-site VPN in Part 1: since there's a public internet between the two separate networks, they're connected through an encrypted tunnel.&lt;/p&gt;

&lt;p&gt;VPC peering describes a different scenario. Here, both networks already sit inside the same cloud provider's own internal infrastructure, and traffic never goes out to the public internet. The connection flows over the provider's own private backbone, and access is controlled through the provider's own permission and firewall rules.&lt;/p&gt;

&lt;p&gt;In short: Cloud VPN encrypts a connection that travels over the internet. VPC peering directly joins a connection that stays within the cloud provider's own network.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is there something similar to a VPN in Kubernetes?
&lt;/h3&gt;

&lt;p&gt;Some network plugins (CNI) encrypt traffic between pods. A service mesh (like Istio, Linkerd) provides similar security at the application level, using mTLS.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is SD-WAN, how does it work?
&lt;/h3&gt;

&lt;p&gt;Think of a company with many branches: each branch may have multiple tunnels reaching headquarters through different types of connections (like a dedicated line, regular fiber internet, or a backup mobile line). In the classic approach, which traffic goes over which line is set manually and stays fixed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SD-WAN (Software-Defined WAN)&lt;/strong&gt; manages this automatically, through central software:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It continuously measures the real-time status of the available connections (latency, packet loss, cost).&lt;/li&gt;
&lt;li&gt;It decides based on how important the traffic is. For example, it might route a video call over the lowest-latency line, and a file backup over the cheapest line.&lt;/li&gt;
&lt;li&gt;If a line fails, it automatically shifts traffic to another line, without needing a person to step in.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most of these tunnels are already encrypted with VPN protocols (like IPsec); SD-WAN adds a smart routing layer on top of the tunnels that already exist. In short: site-to-site VPN solves "how do you set up a tunnel," while SD-WAN solves "how do you best distribute traffic across many tunnels."&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>networking</category>
      <category>security</category>
    </item>
    <item>
      <title>The Heart of .NET: A Deep Dive into the System Namespace</title>
      <dc:creator>sadık emre</dc:creator>
      <pubDate>Fri, 14 Aug 2026 02:00:55 +0000</pubDate>
      <link>https://dev.to/csadikemre/the-heart-of-net-a-deep-dive-into-the-system-namespace-db0</link>
      <guid>https://dev.to/csadikemre/the-heart-of-net-a-deep-dive-into-the-system-namespace-db0</guid>
      <description>&lt;p&gt;If you write C# every day, you use the &lt;strong&gt;System&lt;/strong&gt; namespace all the time — probably without thinking about it. In this post, we'll slow down and really look at it: what it is, what's inside it, where it stops, how it got here, and where it's going next.&lt;/p&gt;

&lt;p&gt;I'll keep the words simple, but I won't skip the details.&lt;/p&gt;

&lt;h2&gt;
  
  
  A quick but important note: "System" is not a class
&lt;/h2&gt;

&lt;p&gt;Let's clear up a common mix-up first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;System&lt;/strong&gt; is not a single class. It's a &lt;strong&gt;namespace&lt;/strong&gt; — a logical group that holds many classes, structs, interfaces, and delegates. Types like &lt;code&gt;System.String&lt;/code&gt;, &lt;code&gt;System.Console&lt;/code&gt;, and &lt;code&gt;System.DateTime&lt;/code&gt; live &lt;em&gt;inside&lt;/em&gt; this namespace.&lt;/p&gt;

&lt;p&gt;This matters because System is not one file or one DLL either. There's a whole architecture behind it, and we'll get to that soon.&lt;/p&gt;

&lt;h2&gt;
  
  
  How long has System been around?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;2002&lt;/strong&gt; — System was born with .NET Framework 1.0. It has been the backbone of every .NET version since then.&lt;/li&gt;
&lt;li&gt;It was designed together with the &lt;strong&gt;CLR (Common Language Runtime)&lt;/strong&gt;, the engine that runs your code. System became the "base library" built on top of that engine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's over 20 years of active use and active development. In software terms, that's a long life — and System is far from outdated. It gets updated every single year.&lt;/p&gt;

&lt;p&gt;So how is this huge, decades-old thing organized on the inside? That's where "namespace levels" come in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Namespace levels: what does "level" actually mean?
&lt;/h2&gt;

&lt;p&gt;A namespace is a purely &lt;strong&gt;logical&lt;/strong&gt; grouping, separated by dots (&lt;code&gt;.&lt;/code&gt;). It's not a real folder on your disk — it's just a way to organize code.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Level&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;th&gt;Examples&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Root level&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No dots at all, sits at the very top&lt;/td&gt;
&lt;td&gt;&lt;code&gt;System&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Level 1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Contains one dot&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;System.Collections&lt;/code&gt;, &lt;code&gt;System.Linq&lt;/code&gt;, &lt;code&gt;System.IO&lt;/code&gt;, &lt;code&gt;System.Threading&lt;/code&gt;, &lt;code&gt;System.Text&lt;/code&gt;, &lt;code&gt;System.Net&lt;/code&gt;, &lt;code&gt;System.Reflection&lt;/code&gt;, &lt;code&gt;System.Diagnostics&lt;/code&gt;, &lt;code&gt;System.Security&lt;/code&gt;, &lt;code&gt;System.Numerics&lt;/code&gt;, &lt;code&gt;System.Globalization&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Level 2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Contains two dots&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;System.Collections.Generic&lt;/code&gt;, &lt;code&gt;System.Threading.Tasks&lt;/code&gt;, &lt;code&gt;System.Text.Json&lt;/code&gt;, &lt;code&gt;System.Security.Cryptography&lt;/code&gt;, &lt;code&gt;System.Net.Http&lt;/code&gt;, &lt;code&gt;System.Text.RegularExpressions&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Level 3 and beyond&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Three or more dots&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;System.Runtime.CompilerServices&lt;/code&gt;, &lt;code&gt;System.Diagnostics.CodeAnalysis&lt;/code&gt;, &lt;code&gt;System.Threading.Tasks.Dataflow&lt;/code&gt;, &lt;code&gt;System.Collections.ObjectModel&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Why is it split up like this?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Logical grouping&lt;/strong&gt; — related types stay together. All collection types live under &lt;code&gt;Collections&lt;/code&gt;, all networking types live under &lt;code&gt;Net&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoiding name clashes&lt;/strong&gt; — two namespaces can have a type with the same name. For example, both &lt;code&gt;System.Threading.Timer&lt;/code&gt; and &lt;code&gt;System.Timers.Timer&lt;/code&gt; exist. Without namespaces, these would collide.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pick only what you need&lt;/strong&gt; — you bring in one namespace with &lt;code&gt;using&lt;/code&gt;, without pulling in everything else.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Levels don't automatically include each other
&lt;/h3&gt;

&lt;p&gt;Writing &lt;code&gt;using System.Collections.Generic;&lt;/code&gt; does not automatically add &lt;code&gt;System&lt;/code&gt;. And writing &lt;code&gt;using System;&lt;/code&gt; does not give you the &lt;code&gt;Where&lt;/code&gt; or &lt;code&gt;Select&lt;/code&gt; methods from &lt;code&gt;System.Linq&lt;/code&gt;. Each level is its own independent unit — you need &lt;code&gt;using&lt;/code&gt; for each one, wherever you use it.&lt;/p&gt;

&lt;p&gt;Also, the namespace hierarchy and the physical assembly (DLL) structure don't line up perfectly. &lt;code&gt;System.Linq&lt;/code&gt; sits logically under &lt;code&gt;System&lt;/code&gt;, but it can live in its own DLL (&lt;code&gt;System.Linq.dll&lt;/code&gt;). A namespace is about "folders" of logic; an assembly is about "which file." These are two different things.&lt;/p&gt;

&lt;p&gt;Now that we've seen how namespaces are organized, let's look at how the &lt;em&gt;things inside them&lt;/em&gt; differ from each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Class, struct, interface, delegate, method: who does what?
&lt;/h2&gt;

&lt;p&gt;Before we get into tables, let's make these five terms clear. They're all "types," but they play very different roles.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Term&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Class&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A reference type. Holds data (fields/properties) and behavior (methods) together, and supports inheritance&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Console&lt;/code&gt;, &lt;code&gt;StringBuilder&lt;/code&gt;, &lt;code&gt;Exception&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Struct&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A value type. Usually small, lightweight, and often immutable (can't be changed)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;DateTime&lt;/code&gt;, &lt;code&gt;Guid&lt;/code&gt;, &lt;code&gt;TimeSpan&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Interface&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Not an actual implementation — it's a &lt;strong&gt;contract&lt;/strong&gt;. It says which methods/properties must exist&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;IDisposable&lt;/code&gt;, &lt;code&gt;IComparable&amp;lt;T&amp;gt;&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Delegate&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A type-safe "pointer to a function" — lets you pass a method around like a value&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Action&amp;lt;T&amp;gt;&lt;/code&gt;, &lt;code&gt;Func&amp;lt;T,TResult&amp;gt;&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Method&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A block of code defined inside a class or struct that does one job&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;String.ToUpper()&lt;/code&gt;, &lt;code&gt;Console.WriteLine()&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A class defines "what something is." A method defines "what it can do." An interface doesn't do anything by itself — it just says "you need to do this." The actual work is done by the classes that implement it.&lt;/p&gt;

&lt;h3&gt;
  
  
  The real System classes hiding behind C# keywords
&lt;/h3&gt;

&lt;p&gt;Here's something interesting: keywords like &lt;code&gt;class&lt;/code&gt;, &lt;code&gt;struct&lt;/code&gt;, &lt;code&gt;enum&lt;/code&gt;, and &lt;code&gt;delegate&lt;/code&gt; in C# are actually &lt;strong&gt;syntactic sugar&lt;/strong&gt; — shortcuts the compiler links to real classes in the System namespace behind the scenes.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;C# keyword&lt;/th&gt;
&lt;th&gt;The real base class behind it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;class&lt;/code&gt; (when you don't specify a base class)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;System.Object&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;struct&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;System.ValueType&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;enum&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;System.Enum&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;delegate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;System.MulticastDelegate&lt;/code&gt; (which itself comes from &lt;code&gt;System.Delegate&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So when you write &lt;code&gt;enum Color { Red, Blue }&lt;/code&gt;, the compiler treats it as a type that inherits from &lt;code&gt;System.Enum&lt;/code&gt; behind the scenes. This also explains why enums have methods like &lt;code&gt;.ToString()&lt;/code&gt; and &lt;code&gt;.HasFlag()&lt;/code&gt; — they all come from &lt;code&gt;System.Enum&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Boxing and unboxing: how value types become System.Object
&lt;/h3&gt;

&lt;p&gt;Since &lt;code&gt;System.Object&lt;/code&gt; is the ancestor of every type, something interesting happens when you want to treat a value type (like &lt;code&gt;int&lt;/code&gt;) as an &lt;code&gt;object&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Boxing&lt;/strong&gt; — the value type's data gets wrapped in a "box" on the heap and turned into a reference type: &lt;code&gt;object box = 5;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unboxing&lt;/strong&gt; — that boxed value gets converted back to its original value type: &lt;code&gt;int number = (int)box;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This looks small, but it has a real performance cost (extra heap allocation, type checks). It's also one reason generic collections (like &lt;code&gt;List&amp;lt;int&amp;gt;&lt;/code&gt;) are faster than old, non-generic collections (like &lt;code&gt;ArrayList&lt;/code&gt;, which is &lt;code&gt;object&lt;/code&gt;-based): generic collections don't need boxing or unboxing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Static classes: why you don't "new" up a Console
&lt;/h3&gt;

&lt;p&gt;You've probably noticed you never write &lt;code&gt;new Console()&lt;/code&gt; when calling &lt;code&gt;Console.WriteLine()&lt;/code&gt;. That's because classes like &lt;code&gt;Console&lt;/code&gt;, &lt;code&gt;Math&lt;/code&gt;, &lt;code&gt;Convert&lt;/code&gt;, and &lt;code&gt;Environment&lt;/code&gt; are defined as &lt;strong&gt;static classes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A static class:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can't be instantiated — you can't create an object from it with &lt;code&gt;new&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;All its members (methods, properties) are called directly through the class name.&lt;/li&gt;
&lt;li&gt;Usually holds no state — it just offers behavior or helper functions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This design makes sense: there's no need for "multiple instances" of the console or of math operations. One console, one math library, is enough for the whole system.&lt;/p&gt;

&lt;p&gt;Now that the basic concepts are clear, let's take a step back and ask: where do all these classes, structs, and interfaces actually live?&lt;/p&gt;

&lt;h2&gt;
  
  
  Behind the scenes: how is System actually packaged?
&lt;/h2&gt;

&lt;p&gt;Most people picture System as "one big DLL." That's not how it really works — but before we get there, let's clear up a few acronyms you'll keep running into, because they all describe different layers of this same packaging story:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Acronym&lt;/th&gt;
&lt;th&gt;Full name&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CLR&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Common Language Runtime&lt;/td&gt;
&lt;td&gt;The engine that runs your code — memory management, JIT compiling, and garbage collection all happen here&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CTS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Common Type System&lt;/td&gt;
&lt;td&gt;The shared type rules that all .NET languages (C#, F#, VB.NET) agree on&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CLS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Common Language Specification&lt;/td&gt;
&lt;td&gt;The minimum set of rules different .NET languages must follow so their code can work together&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;BCL&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Base Class Library&lt;/td&gt;
&lt;td&gt;The most fundamental library on top of the CLR; most of the System namespace lives here&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;FCL&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Framework Class Library&lt;/td&gt;
&lt;td&gt;BCL plus the wider libraries built on top of it (in the old .NET Framework days, this was the umbrella term covering everything, including ASP.NET and WinForms)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In short: the CLR &lt;em&gt;runs&lt;/em&gt; your code, CTS/CLS &lt;em&gt;set the type rules&lt;/em&gt;, and BCL/FCL are the &lt;em&gt;ready-made libraries&lt;/em&gt; built on top of those rules. System is the core of the BCL. So where does the BCL actually live, physically? That's where the real assembly architecture comes in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;mscorlib.dll&lt;/strong&gt; — the historic assembly that held most of the System types back in the .NET Framework days.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System.Private.CoreLib.dll&lt;/strong&gt; — the internal assembly that replaced mscorlib after .NET Core, holding the &lt;em&gt;real&lt;/em&gt; implementation of these types. The word "Private" isn't there by accident — this assembly isn't meant to be referenced directly. It's an internal, runtime-specific piece.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reference assemblies&lt;/strong&gt; like &lt;code&gt;System.Runtime.dll&lt;/code&gt; — the contract files you see at compile time, which get filled in with the real implementation at runtime.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So System looks like one solid block to a developer, but behind the scenes it's built as a &lt;strong&gt;modular package&lt;/strong&gt;. This lets pieces get updated independently, get distributed through NuGet, and get trimmed away when an app doesn't need them.&lt;/p&gt;

&lt;p&gt;This architecture didn't appear overnight — let's take a quick trip through time to see how we got here.&lt;/p&gt;

&lt;h2&gt;
  
  
  The evolution story: from Windows-only to everywhere
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Era 1 — .NET Framework (roughly 2002–2019):&lt;/strong&gt; Windows-only, one big monolithic piece.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Era 2 — .NET Core (from 2016):&lt;/strong&gt; Open source, cross-platform (Windows/Linux/macOS), modular. System got split into small NuGet packages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Era 3 — .NET 5 and beyond (2020+):&lt;/strong&gt; Framework and Core merged into one. A single, consistent platform with a yearly release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A quick side note — .NET Standard:&lt;/strong&gt; Between these eras, there was a bridge concept called &lt;code&gt;.NET Standard&lt;/code&gt;. It defined which common System APIs different .NET flavors (Framework, Core, Xamarin, etc.) all supported. Once .NET 5 merged the platforms, the need for this bridge mostly went away — but you'll still see targets like &lt;code&gt;netstandard2.0&lt;/code&gt; in older libraries.&lt;/p&gt;

&lt;p&gt;The philosophy shifted too: System used to be "one giant library that includes everything." Today it's "a lean, performance-first core that shrinks when it needs to." One of the clearest results of this shift is how much attention performance gets now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Specializing for performance
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Span&amp;lt;T&amp;gt;&lt;/code&gt; / &lt;code&gt;Memory&amp;lt;T&amp;gt;&lt;/code&gt; — work with memory without copying it, cutting down on allocations by a lot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generic math&lt;/strong&gt; (interfaces like &lt;code&gt;INumber&amp;lt;T&amp;gt;&lt;/code&gt;) — write type-safe, reusable math code that works across different numeric types.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SIMD&lt;/strong&gt; support — use the CPU's vector units (like AVX or ARM SVE) directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native AOT&lt;/strong&gt; — compile straight to machine code with no runtime needed, shrinking startup time and memory footprint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ArrayPool&lt;/strong&gt; (in &lt;code&gt;System.Buffers&lt;/code&gt;) — a memory pool for arrays you use often, so you reuse memory instead of allocating a new array every time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These performance goals show up most clearly in the current release.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where things stand today: .NET 10 and System
&lt;/h2&gt;

&lt;p&gt;.NET 10 shipped in &lt;strong&gt;November 2025&lt;/strong&gt; as an LTS (Long-Term Support) release, supported until 2028. Highlights include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;New APIs across cryptography, diagnostics, numerics, globalization, and serialization.&lt;/li&gt;
&lt;li&gt;AI moved to the center of the platform with the &lt;strong&gt;Microsoft Agent Framework&lt;/strong&gt;, letting you build AI agents directly into .NET apps.&lt;/li&gt;
&lt;li&gt;JIT compiler improvements for structs, loops, and array handling.&lt;/li&gt;
&lt;li&gt;Pieces like &lt;code&gt;System.Linq.AsyncEnumerable&lt;/code&gt; becoming part of the core libraries.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's happening right now: .NET 11 in preview
&lt;/h2&gt;

&lt;p&gt;System is &lt;strong&gt;still being actively developed&lt;/strong&gt; — right now, as you're reading this. .NET 11 is set to ship in November 2026, and preview releases are coming out one after another.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Runtime Async&lt;/strong&gt; — async code redesigned at the runtime level, aiming for cleaner stack traces and less overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CoreCLR running on WebAssembly&lt;/strong&gt; — deeper integration between .NET and browser/WASM environments.&lt;/li&gt;
&lt;li&gt;Built-in &lt;strong&gt;Zstandard&lt;/strong&gt; compression support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BFloat16&lt;/strong&gt; and other numeric types built for AI workloads.&lt;/li&gt;
&lt;li&gt;Updated hardware requirements.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where is System heading?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Cloud-first design&lt;/strong&gt; — containers, microservices, fast startup times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI built in&lt;/strong&gt; — AI agents embedded directly into the platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance close to the hardware&lt;/strong&gt; — SIMD, generic math, Native AOT.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Staying modular and small&lt;/strong&gt; — only the pieces you need get shipped.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expanding across platforms&lt;/strong&gt; — WebAssembly, mobile, embedded systems.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But this growth isn't unlimited. System is deliberately kept small — which is exactly why it's worth looking closely at where its limits are.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where System falls short — and who fills the gap
&lt;/h2&gt;

&lt;p&gt;This is probably the clearest proof that System is not trying to be "a library that does everything." It's intentionally kept limited.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Need&lt;/th&gt;
&lt;th&gt;What System offers&lt;/th&gt;
&lt;th&gt;Who fills the gap&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Dependency Injection&lt;/td&gt;
&lt;td&gt;Nothing built in&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Microsoft.Extensions.DependencyInjection&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Structured logging&lt;/td&gt;
&lt;td&gt;Only basic &lt;code&gt;Debug&lt;/code&gt;/&lt;code&gt;Trace&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Microsoft.Extensions.Logging&lt;/code&gt;, &lt;strong&gt;Serilog&lt;/strong&gt;, &lt;strong&gt;NLog&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;App configuration&lt;/td&gt;
&lt;td&gt;Nothing built in&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Microsoft.Extensions.Configuration&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Web/API framework&lt;/td&gt;
&lt;td&gt;Nothing but &lt;code&gt;HttpClient&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;ASP.NET Core&lt;/strong&gt; (&lt;code&gt;Microsoft.AspNetCore.*&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ORM / database access&lt;/td&gt;
&lt;td&gt;Only the old &lt;code&gt;System.Data&lt;/code&gt; (ADO.NET)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Entity Framework Core&lt;/strong&gt;, &lt;strong&gt;Dapper&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Advanced/flexible JSON&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;System.Text.Json&lt;/code&gt; exists but can fall short in some polymorphic or legacy cases&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Newtonsoft.Json (Json.NET)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reactive programming (Rx)&lt;/td&gt;
&lt;td&gt;Nothing built in&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;System.Reactive&lt;/strong&gt; — despite the name, it's a separate NuGet package, not part of the core&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unit testing&lt;/td&gt;
&lt;td&gt;Nothing built in&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;xUnit&lt;/strong&gt;, &lt;strong&gt;NUnit&lt;/strong&gt;, &lt;strong&gt;MSTest&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Object-to-object mapping&lt;/td&gt;
&lt;td&gt;Nothing built in&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;AutoMapper&lt;/strong&gt;, &lt;strong&gt;Mapster&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Advanced validation&lt;/td&gt;
&lt;td&gt;Basic &lt;code&gt;DataAnnotations&lt;/code&gt; exist&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;FluentValidation&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Resilience (retry, circuit breaker)&lt;/td&gt;
&lt;td&gt;Nothing built in&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Polly&lt;/strong&gt;, now becoming official through &lt;code&gt;Microsoft.Extensions.Resilience&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Complex time zone/calendar math&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;TimeZoneInfo&lt;/code&gt; exists but falls short in some edge cases&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;NodaTime&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Image processing&lt;/td&gt;
&lt;td&gt;Old &lt;code&gt;System.Drawing&lt;/code&gt;, tied to Windows&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;SixLabors.ImageSharp&lt;/strong&gt;, &lt;strong&gt;SkiaSharp&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Desktop/mobile UI&lt;/td&gt;
&lt;td&gt;Nothing built in&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;WPF&lt;/strong&gt;, &lt;strong&gt;WinForms&lt;/strong&gt;, &lt;strong&gt;.NET MAUI&lt;/strong&gt;, &lt;strong&gt;Avalonia&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI / LLM integration&lt;/td&gt;
&lt;td&gt;Nothing built in&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Microsoft.Extensions.AI&lt;/code&gt;, &lt;strong&gt;Semantic Kernel&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Messaging/queue systems&lt;/td&gt;
&lt;td&gt;Nothing built in&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;MassTransit&lt;/strong&gt;, RabbitMQ/Kafka clients&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The general rule: &lt;strong&gt;System covers the basic needs of the language and the runtime. The layer that business apps actually need — web, DI, logging, ORM — comes from the &lt;code&gt;Microsoft.Extensions.*&lt;/code&gt; family and the wider NuGet ecosystem.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Alongside these limits, some pieces have also been deliberately removed over time — that deserves its own section too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Backward compatibility and what's been removed over time
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;BinaryFormatter&lt;/strong&gt; — removed from newer .NET versions due to security risks. &lt;code&gt;System.Text.Json&lt;/code&gt; is the recommended replacement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CAS (Code Access Security)&lt;/strong&gt; — largely dropped with .NET Core.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Remoting&lt;/strong&gt; — replaced by modern HTTP/gRPC-based communication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System.Drawing on non-Windows platforms&lt;/strong&gt; — restricted on cross-platform .NET Core because of its dependency on Windows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Enough theory — let's get practical. How can you actually see this namespace inside your own project?&lt;/p&gt;

&lt;h2&gt;
  
  
  Where can you actually see these default namespaces in your project?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. ImplicitUsings: seeing your default &lt;code&gt;using&lt;/code&gt;s in a real file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This feature, added in .NET 6, automatically adds the most common namespaces for your project type, so you don't have to write &lt;code&gt;using System;&lt;/code&gt; in every single file. You can see this in a real file in three steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 — Make sure the feature is turned on.&lt;/strong&gt; Your &lt;code&gt;.csproj&lt;/code&gt; file should contain this line (it's already on by default in new projects):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;ImplicitUsings&amp;gt;&lt;/span&gt;enable&lt;span class="nt"&gt;&amp;lt;/ImplicitUsings&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2 — Find the file the compiler generates.&lt;/strong&gt; After you build the project once (&lt;code&gt;dotnet build&lt;/code&gt;), the compiler creates a file behind the scenes at this path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="n"&gt;Debug&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="n"&gt;net10&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;YourProjectName&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;.&lt;/span&gt;&lt;span class="n"&gt;GlobalUsings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3 — Open it. Here's what your default &lt;code&gt;using&lt;/code&gt;s really look like:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;global&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;global&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Collections&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Generic&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;global&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IO&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;global&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Linq&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;global&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Threading&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;global&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Threading&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Tasks&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So even if you never open this file, these six namespaces are already available in every &lt;code&gt;.cs&lt;/code&gt; file in your project. This is what "the default namespaces" really means.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Not all &lt;code&gt;using&lt;/code&gt;s are the same&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;global using&lt;/code&gt; you saw above is just one of a few different kinds of &lt;code&gt;using&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;using&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Makes a namespace available in that one file only&lt;/td&gt;
&lt;td&gt;&lt;code&gt;using System.Text;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;global using&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Makes a namespace available in &lt;strong&gt;every&lt;/strong&gt; file in the project&lt;/td&gt;
&lt;td&gt;&lt;code&gt;global using System;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;using static&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lets you call a class's static members without writing the class name&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;using static System.Math;&lt;/code&gt; → now you can just write &lt;code&gt;Sqrt(4)&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;using X = Y&lt;/code&gt; (alias)&lt;/td&gt;
&lt;td&gt;Gives a long type name a short nickname, useful for resolving name clashes&lt;/td&gt;
&lt;td&gt;&lt;code&gt;using Timer = System.Threading.Timer;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;3. The "Dependencies" node in your IDE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Solution Explorer, expand &lt;strong&gt;Dependencies &amp;gt; Frameworks &amp;gt; Microsoft.NETCore.App&lt;/strong&gt; to see exactly which assemblies System is split into, by their real DLL names.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. The shared runtime folder on disk&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows: &lt;code&gt;C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.x\&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Linux/macOS: &lt;code&gt;/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.x/&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. "Go to Definition" to look inside&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;strong&gt;F12&lt;/strong&gt; on any System type, and your IDE decompiles and shows it to you automatically. You can also open &lt;code&gt;System.Private.CoreLib.dll&lt;/code&gt; with a tool like &lt;strong&gt;ILSpy&lt;/strong&gt; or &lt;strong&gt;dotPeek&lt;/strong&gt; and browse all its classes as a tree.&lt;/p&gt;

&lt;p&gt;Now that you've seen all this, let's answer a few questions that tend to come up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is System a DLL?&lt;/strong&gt; No. It's a namespace, and its contents are spread across multiple assemblies and NuGet packages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does System.Object matter so much?&lt;/strong&gt; It's the root of .NET's type system. Every value type and reference type comes from it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's the difference between System and Microsoft namespaces?&lt;/strong&gt; &lt;code&gt;System.*&lt;/code&gt; is closer to the core language and runtime. &lt;code&gt;Microsoft.*&lt;/code&gt; covers tooling and higher-level frameworks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is System open source?&lt;/strong&gt; Yes, it's developed in the open at &lt;code&gt;github.com/dotnet/runtime&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is it still being developed?&lt;/strong&gt; Absolutely. A new major version ships every November.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Who develops System?&lt;/strong&gt; Microsoft's .NET team leads the work, but since it's open source, independent contributors from around the world are involved too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference section: namespaces and their types, in detail
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;For the curious reader — if you want to turn everything you've read so far into concrete class and interface names, this section is for you. If you'd rather move fast, feel free to skip it.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  System (root level)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classes and structs&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Kind&lt;/th&gt;
&lt;th&gt;What it's for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Object&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;The ancestor of every type; &lt;code&gt;ToString()&lt;/code&gt;, &lt;code&gt;Equals()&lt;/code&gt;, &lt;code&gt;GetHashCode()&lt;/code&gt; all come from here&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;String&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;Text handling; immutable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Array&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;The base class for all array types&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Convert&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;Converting between types (&lt;code&gt;Convert.ToInt32&lt;/code&gt;, etc.)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Math&lt;/code&gt; / &lt;code&gt;MathF&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;Math operations (double / float versions)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Random&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;Random number generation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Console&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;Reading from and writing to the console&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Environment&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;OS info, environment variables, process info&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Exception&lt;/code&gt; and its subclasses&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ArgumentException&lt;/code&gt;, &lt;code&gt;NullReferenceException&lt;/code&gt;, etc. — the backbone of error handling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Version&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;Represents a version number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;WeakReference&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;Tells the garbage collector "you can collect this if you need to"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Uri&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;Parsing and validating URLs/URIs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Tuple&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;Grouping multiple values together (reference type version)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Lazy&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;Delays computing a value until it's first accessed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;DateTime&lt;/code&gt;, &lt;code&gt;DateTimeOffset&lt;/code&gt;, &lt;code&gt;TimeSpan&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;struct&lt;/td&gt;
&lt;td&gt;Date and time handling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;DateOnly&lt;/code&gt;, &lt;code&gt;TimeOnly&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;struct&lt;/td&gt;
&lt;td&gt;Added in .NET 6, for date-only or time-only values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Guid&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;struct&lt;/td&gt;
&lt;td&gt;Generating unique identifiers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ValueTuple&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;struct&lt;/td&gt;
&lt;td&gt;Grouping multiple values together (value type version)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Nullable&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;struct&lt;/td&gt;
&lt;td&gt;Lets value types be nullable&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Interfaces&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Interface&lt;/th&gt;
&lt;th&gt;What it's for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;IDisposable&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The contract for releasing unmanaged resources (files, connections, etc.)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;IComparable&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lets two objects be compared for sorting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;IEquatable&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A specialized contract for equality checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ICloneable&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Marks an object as being able to be cloned&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;IServiceProvider&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The core contract behind dependency injection systems — DI itself lives in &lt;code&gt;Microsoft.Extensions&lt;/code&gt;, but this interface is defined in System&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Delegates&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Delegate&lt;/th&gt;
&lt;th&gt;What it's for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Action&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Represents a method that doesn't return a value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Func&amp;lt;T,TResult&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Represents a method that returns a value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Predicate&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Represents a method that checks a condition and returns &lt;code&gt;true&lt;/code&gt;/&lt;code&gt;false&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  System.Collections.Generic
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classes:&lt;/strong&gt; &lt;code&gt;List&amp;lt;T&amp;gt;&lt;/code&gt; (a dynamic list), &lt;code&gt;Dictionary&amp;lt;TKey,TValue&amp;gt;&lt;/code&gt; (key-value pairs), &lt;code&gt;HashSet&amp;lt;T&amp;gt;&lt;/code&gt; (a set of unique items), &lt;code&gt;Queue&amp;lt;T&amp;gt;&lt;/code&gt; (FIFO), &lt;code&gt;Stack&amp;lt;T&amp;gt;&lt;/code&gt; (LIFO), &lt;code&gt;LinkedList&amp;lt;T&amp;gt;&lt;/code&gt; (a doubly linked list), &lt;code&gt;SortedList&amp;lt;TKey,TValue&amp;gt;&lt;/code&gt; and &lt;code&gt;SortedSet&amp;lt;T&amp;gt;&lt;/code&gt; (auto-sorted structures).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interfaces:&lt;/strong&gt; &lt;code&gt;IEnumerable&amp;lt;T&amp;gt;&lt;/code&gt; (lets you loop over a collection), &lt;code&gt;ICollection&amp;lt;T&amp;gt;&lt;/code&gt; (add/remove/count), &lt;code&gt;IList&amp;lt;T&amp;gt;&lt;/code&gt; (access by index), &lt;code&gt;IDictionary&amp;lt;TKey,TValue&amp;gt;&lt;/code&gt; (key-value contract), &lt;code&gt;IComparer&amp;lt;T&amp;gt;&lt;/code&gt; (custom sorting logic).&lt;/p&gt;

&lt;h3&gt;
  
  
  System.Linq
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classes:&lt;/strong&gt; &lt;code&gt;Enumerable&lt;/code&gt; (holds all the classic LINQ methods like &lt;code&gt;Where&lt;/code&gt;, &lt;code&gt;Select&lt;/code&gt;, &lt;code&gt;OrderBy&lt;/code&gt;, &lt;code&gt;GroupBy&lt;/code&gt;, &lt;code&gt;Sum&lt;/code&gt;, &lt;code&gt;Average&lt;/code&gt; for in-memory collections), &lt;code&gt;Queryable&lt;/code&gt; (the same methods, but translatable into queries for outside sources like databases).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interfaces:&lt;/strong&gt; &lt;code&gt;IQueryable&amp;lt;T&amp;gt;&lt;/code&gt; (lets a query be deferred/delayed — the foundation of ORMs like EF Core), &lt;code&gt;IOrderedEnumerable&amp;lt;T&amp;gt;&lt;/code&gt; (lets you chain &lt;code&gt;ThenBy&lt;/code&gt; after &lt;code&gt;OrderBy&lt;/code&gt; for secondary sorting).&lt;/p&gt;

&lt;h3&gt;
  
  
  System.IO
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classes:&lt;/strong&gt; &lt;code&gt;File&lt;/code&gt; and &lt;code&gt;Directory&lt;/code&gt; (static file/folder operations), &lt;code&gt;FileInfo&lt;/code&gt; and &lt;code&gt;DirectoryInfo&lt;/code&gt; (object-based info and operations), &lt;code&gt;Path&lt;/code&gt; (combining paths, extracting extensions), &lt;code&gt;Stream&lt;/code&gt; (the base class for all streams), &lt;code&gt;FileStream&lt;/code&gt;, &lt;code&gt;MemoryStream&lt;/code&gt;, &lt;code&gt;StreamReader&lt;/code&gt;/&lt;code&gt;StreamWriter&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  System.Threading / System.Threading.Tasks
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classes:&lt;/strong&gt; &lt;code&gt;Thread&lt;/code&gt;, &lt;code&gt;ThreadPool&lt;/code&gt;, &lt;code&gt;Mutex&lt;/code&gt;, &lt;code&gt;Semaphore&lt;/code&gt;, &lt;code&gt;Monitor&lt;/code&gt; (the mechanism behind &lt;code&gt;lock&lt;/code&gt;), &lt;code&gt;Interlocked&lt;/code&gt; (atomic operations), &lt;code&gt;Task&lt;/code&gt;/&lt;code&gt;Task&amp;lt;T&amp;gt;&lt;/code&gt;, &lt;code&gt;CancellationTokenSource&lt;/code&gt;, &lt;code&gt;Parallel&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structs:&lt;/strong&gt; &lt;code&gt;CancellationToken&lt;/code&gt; — carries the "should this be cancelled?" signal to an operation.&lt;/p&gt;

&lt;h3&gt;
  
  
  System.Text / System.Text.Json / System.Text.RegularExpressions
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classes:&lt;/strong&gt; &lt;code&gt;StringBuilder&lt;/code&gt; (efficient text building), &lt;code&gt;Encoding&lt;/code&gt; (character encoding), &lt;code&gt;JsonSerializer&lt;/code&gt; and &lt;code&gt;JsonDocument&lt;/code&gt; (converting/inspecting JSON), &lt;code&gt;Regex&lt;/code&gt; (regular expressions).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structs:&lt;/strong&gt; &lt;code&gt;JsonElement&lt;/code&gt; — represents a single JSON value inside a &lt;code&gt;JsonDocument&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  System.Net.Http
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classes:&lt;/strong&gt; &lt;code&gt;HttpClient&lt;/code&gt;, &lt;code&gt;HttpRequestMessage&lt;/code&gt;, &lt;code&gt;HttpResponseMessage&lt;/code&gt;, &lt;code&gt;HttpContent&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  System.Reflection
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classes:&lt;/strong&gt; &lt;code&gt;Assembly&lt;/code&gt; (a compiled assembly), &lt;code&gt;MethodInfo&lt;/code&gt;, &lt;code&gt;PropertyInfo&lt;/code&gt;, &lt;code&gt;FieldInfo&lt;/code&gt; — all let you inspect a type at runtime.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: &lt;code&gt;Type&lt;/code&gt;, the class most often used alongside Reflection, is actually not defined in &lt;code&gt;System.Reflection&lt;/code&gt; — it lives in the &lt;code&gt;System&lt;/code&gt; root namespace.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  System.Diagnostics
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classes:&lt;/strong&gt; &lt;code&gt;Debug&lt;/code&gt; (only runs in debug builds), &lt;code&gt;Trace&lt;/code&gt; (runs in both debug and release), &lt;code&gt;Stopwatch&lt;/code&gt; (measuring time), &lt;code&gt;Process&lt;/code&gt; (managing external processes), &lt;code&gt;Activity&lt;/code&gt; (distributed tracing).&lt;/p&gt;

&lt;h3&gt;
  
  
  System.Security.Cryptography
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classes:&lt;/strong&gt; &lt;code&gt;SHA256&lt;/code&gt;/&lt;code&gt;SHA512&lt;/code&gt; (hashing), &lt;code&gt;Aes&lt;/code&gt; (symmetric encryption), &lt;code&gt;RSA&lt;/code&gt; (asymmetric encryption), &lt;code&gt;RandomNumberGenerator&lt;/code&gt; (cryptographically secure randomness).&lt;/p&gt;

&lt;h3&gt;
  
  
  System.Numerics
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Structs:&lt;/strong&gt; &lt;code&gt;BigInteger&lt;/code&gt; (arbitrarily large integers), &lt;code&gt;Complex&lt;/code&gt; (complex numbers), &lt;code&gt;Vector&amp;lt;T&amp;gt;&lt;/code&gt; (SIMD-accelerated vector operations).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interfaces:&lt;/strong&gt; &lt;code&gt;INumber&amp;lt;T&amp;gt;&lt;/code&gt; and &lt;code&gt;INumberBase&amp;lt;T&amp;gt;&lt;/code&gt; — the foundation of generic math, defining shared math behavior across different numeric types.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;System is not one class — it's a root-level namespace holding .NET's core building blocks.&lt;/li&gt;
&lt;li&gt;It has its own sub-namespaces at level 1, level 2, and deeper; each level needs its own &lt;code&gt;using&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Its contents fall into distinct roles — classes, structs, interfaces, delegates — and keywords like &lt;code&gt;enum&lt;/code&gt;, &lt;code&gt;struct&lt;/code&gt;, and &lt;code&gt;delegate&lt;/code&gt; are backed by real System classes.&lt;/li&gt;
&lt;li&gt;The CLR runs your code, CTS/CLS define the type rules, and BCL/FCL are the ready-made libraries built on those rules — System is the heart of the BCL.&lt;/li&gt;
&lt;li&gt;It's been around since 2002 and is still actively developed every year.&lt;/li&gt;
&lt;li&gt;It's intentionally kept limited — needs like web frameworks, DI, logging, and ORMs are covered by &lt;code&gt;Microsoft.Extensions.*&lt;/code&gt; and the wider NuGet ecosystem.&lt;/li&gt;
&lt;li&gt;You can see this namespace for yourself in &lt;code&gt;GlobalUsings.g.cs&lt;/code&gt;, your IDE's Dependencies node, or the &lt;code&gt;shared/Microsoft.NETCore.App&lt;/code&gt; folder on disk.&lt;/li&gt;
&lt;li&gt;The evolution is still going, with .NET 11 previews shipping right now — the next big milestone is November 2026.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>backend</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>C#'ta Ters Hissettiren Polimorfizm</title>
      <dc:creator>sadık emre</dc:creator>
      <pubDate>Sun, 26 Jul 2026 09:49:38 +0000</pubDate>
      <link>https://dev.to/csadikemre/-cta-ters-hissettiren-polimorfizm-68h</link>
      <guid>https://dev.to/csadikemre/-cta-ters-hissettiren-polimorfizm-68h</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp0s1bejy7t0kpw9r6c43.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp0s1bejy7t0kpw9r6c43.webp" alt="ladybug" width="800" height="631"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bir metodun hangi sınıfa ait olduğu bazen göründüğü kadar net değil. C#'ta polimorfizm çoğu zaman beklendiği gibi çalışır, ama bazı durumlarda tam tersi olur ve bu hatalar genelde code review'a kadar fark edilmeden ilerler.&lt;/p&gt;

&lt;p&gt;Aşağıda dört örnek var.&lt;/p&gt;

&lt;p&gt;Hepsinde "hangi metot çalışır" sorusunun cevabı beklenenden farklı çıkıyor.&lt;/p&gt;

&lt;p&gt;Sebebini örneklerden sonra birlikte açacağız.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Constructor İçinden Metot Çağırmak
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MeyveSepeti&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;MeyveSepeti&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;Hazirla&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;virtual&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Hazirla&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Sepet hazırlanıyor"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ElmaSepeti&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;MeyveSepeti&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;_meyveAdi&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Elma"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;ElmaSepeti&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;meyveAdi&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;_meyveAdi&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;meyveAdi&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Hazirla&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"Sepetten &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;_meyveAdi&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt; alınıyor"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;sepet&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ElmaSepeti&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Armut"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Çıktı: Sepetten  alınıyor (meyve adı boş çıkıyor)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Beklenen çıktı "Sepetten Armut alınıyor" gibi görünüyor, ama öyle olmuyor.&lt;/p&gt;

&lt;p&gt;Çağrılan metot ElmaSepeti'nin metodu oluyor, doğru. Ama o an _meyveAdi henüz hiç değer almamış, adı boş çıkıyor.&lt;/p&gt;

&lt;p&gt;Roslyn (C#'ın kod analizi yapan derleyici altyapısı) bu durumu ayrı bir kuralla işaretliyor: CA2214. Kural, constructor içinde override edilebilir bir metot çağrıldığında uyarı veriyor. Projede açık değilse fark edilmeden geçebiliyor.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Aynı Sınıftaki Bir Metodun Başka Bir Metodu Çağırması
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MeyveSepeti&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;virtual&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;SesVer&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Sepetten ses geliyor"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Duyur&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SesVer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ElmaSepeti&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;MeyveSepeti&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;SesVer&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Elma sepetinden ses geliyor"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;ElmaSepeti&lt;/span&gt; &lt;span class="n"&gt;sepet&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ElmaSepeti&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;sepet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Duyur&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// Çıktı: Elma sepetinden ses geliyor&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Duyur() metodu MeyveSepeti'de yazılı.&lt;/p&gt;

&lt;p&gt;Ama çalıştığında ElmaSepeti'nin metodunu çağırıyor.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;code&gt;new&lt;/code&gt; ile Metot Gizleme
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MeyveSepeti&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Tanit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Bu bir meyve sepeti"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ArmutSepeti&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;MeyveSepeti&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Tanit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Bu bir armut sepeti"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;MeyveSepeti&lt;/span&gt; &lt;span class="n"&gt;sepet&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ArmutSepeti&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;sepet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Tanit&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// Çıktı: Bu bir meyve sepeti&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nesne gerçekte bir ArmutSepeti.&lt;/p&gt;

&lt;p&gt;Ama çıktı "Bu bir armut sepeti" değil, "Bu bir meyve sepeti" oluyor.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Sadece Interface Üzerinden Görünen Metot
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;IKapasiteHesaplanabilir&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;Kapasite&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MeyveSepeti&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IKapasiteHesaplanabilir&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;_boyut&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;MeyveSepeti&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;boyut&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_boyut&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boyut&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;IKapasiteHesaplanabilir&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Kapasite&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_boyut&lt;/span&gt; &lt;span class="p"&gt;*&lt;/span&gt; &lt;span class="n"&gt;_boyut&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;sepet&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;MeyveSepeti&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// sepet.Kapasite(); -&amp;gt; derleme hatası&lt;/span&gt;

&lt;span class="n"&gt;IKapasiteHesaplanabilir&lt;/span&gt; &lt;span class="n"&gt;kapasiteli&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sepet&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;kapasiteli&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Kapasite&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// Çıktı: 16&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;sepet.Kapasite() hiç çalışmıyor, derleme hatası veriyor.&lt;/p&gt;

&lt;p&gt;Aynı metot, kapasiteli.Kapasite() olarak yazınca çalışıyor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Peki Bu Dördünün Sebebi Ne?
&lt;/h2&gt;

&lt;p&gt;Dört örnek de aynı sebepten değil, iki ayrı sebepten kaynaklanıyor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Birinci sebep: nesne oluşurken ayarlanan bir bilgi&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;new ElmaSepeti(...)&lt;/code&gt; çalıştığında sırayla şunlar olur:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Nesne için bellekte yer ayrılır.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bu nesneye, "sen bir ElmaSepeti'sin" bilgisi hemen o anda iliştirilir. Bu bilgi, henüz hiçbir constructor çalışmadan hazır olur.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sonra MeyveSepeti'nin constructor'ı çalışır.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bu constructor içinde bir metot çağrıldığında, çalışma zamanı nesneye iliştirilmiş olan bu bilgiye bakar ve "bu aslında bir ElmaSepeti, o zaman ElmaSepeti'nin metodunu çalıştır" der.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;MeyveSepeti'nin constructor'ı bittikten sonra ElmaSepeti'nin kendi alanları değer alır.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;En son ElmaSepeti'nin constructor gövdesi çalışır.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;örnekte sorun burada: 4. adım, 5. adımdan önce oluyor. Metot doğru sınıfa ait ama alan henüz boş.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;örnekte de aynı 4. adım işliyor, ama bu sefer nesne tam kurulmuş durumda, bu yüzden sonuç aslında doğru. Sürpriz olan tek şey, MeyveSepeti içinde yazılan bir kodun ElmaSepeti'nin metodunu çalıştırabilmesi.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;İkinci sebep: derleyicinin önceden verdiği karar&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;3 ve 4. örnekler bambaşka bir yerden geliyor. Burada çalışma zamanı hiçbir şeye bakmıyor.&lt;/p&gt;

&lt;p&gt;Kod daha derlenirken, derleyici değişkenin hangi tipte tanımlandığına bakıyor ve çağrının nereye gideceğine orada karar veriyor.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;örnekte sepet değişkeni MeyveSepeti tipinde tanımlı. Derleyici bu yüzden çağrıyı MeyveSepeti'nin metoduna bağlıyor, nesnenin gerçekte ArmutSepeti olması hiç önemli değil.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;örnekte ise Kapasite() metodu, MeyveSepeti'nin normal bir üyesi olarak bile tanımlanmamış. Derleyici sepet.Kapasite() yazıldığında bu metodu MeyveSepeti'nin listesinde bulamıyor, hata veriyor.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Özetle: 1 ve 2, nesneye iliştirilen gerçek tip bilgisinden kaynaklanıyor. 3 ve 4 ise derleyicinin değişkenin tanımlı tipine bakarak verdiği erken karardan.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kaçınma Yolları
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Constructor içinde başka bir metot çağırmaktan kaçınmak. Bunun yerine nesneyi ayrı bir metotla, tam kurulduktan sonra hazırlamak.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bir sınıfın kendi metodu başka bir metodunu çağırdığında, bunun alt sınıfta değişebileceğini akılda tutmak.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;override&lt;/code&gt; ve &lt;code&gt;new&lt;/code&gt; arasındaki farkı her zaman açıkça yazmak.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Interface üzerinden yazılan bir metodu çağırırken hangi tipteki değişkeni kullandığına dikkat etmek.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CA2214 kuralını projede açık tutmak.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sonuç
&lt;/h2&gt;

&lt;p&gt;Dört örnek de "hangi metot çalışır" sorusunun cevabının, göründüğünden daha karmaşık olabileceğini gösteriyor.&lt;/p&gt;

&lt;p&gt;Bazen bu cevap nesneye iliştirilen gerçek tip bilgisine bağlı, bazen de derleyicinin daha en baştan verdiği bir karara.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>C#’ta Parametre Geçişi: Referans Tiplerde Gözden Kaçan Nokta</title>
      <dc:creator>sadık emre</dc:creator>
      <pubDate>Fri, 17 Jul 2026 19:46:54 +0000</pubDate>
      <link>https://dev.to/csadikemre/cta-parametre-gecisi-referans-tiplerde-gozden-kacan-nokta-2og2</link>
      <guid>https://dev.to/csadikemre/cta-parametre-gecisi-referans-tiplerde-gozden-kacan-nokta-2og2</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F75ev414rbsiulv441rdi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F75ev414rbsiulv441rdi.png" alt="İki referans aynı adresi tutuyor" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bir metoda &lt;code&gt;string&lt;/code&gt; ya da bir nesne parametre olarak verilip metot içinde bu parametreye yeni bir değer atandığında, çoğu zaman çağıran taraftaki değişken de değişmiş sanılır. Aşağıdaki örnek bu varsayımı çürütüyor — ve çürüme sebebi, çoğu geliştiricinin sandığından farklı.&lt;/p&gt;

&lt;h2&gt;
  
  
  Önce kafa karıştıran örnek
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;TestMetot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Naber!"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Selam"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;TestMetot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Selam&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Metot içinde &lt;code&gt;A&lt;/code&gt;'ya açıkça &lt;code&gt;"Naber!"&lt;/code&gt; atanmasına rağmen çıktı &lt;code&gt;"Selam"&lt;/code&gt;. Derleyici için burada iki bağımsız &lt;code&gt;A&lt;/code&gt; var: &lt;strong&gt;metot dışındaki A&lt;/strong&gt; ve &lt;strong&gt;parametredeki A&lt;/strong&gt;. Bunlar aynı isme sahip ama birbirinden habersiz iki ayrı kutu (değişken).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;string A = "Selam"&lt;/code&gt; çalıştığında ortaya çıkan tablo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Stack:
  metot dışındaki string A, RAM'de 0x100 bellek adresini tutar

Heap:
  0x100 adresine karşılık gelen değer "Selam"dır.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;TestMetot(A)&lt;/code&gt; çağrıldığında, parametredeki &lt;code&gt;A&lt;/code&gt; adında &lt;strong&gt;yeni bir kutu&lt;/strong&gt; açılıyor ve bu kutuya metot dışındaki &lt;code&gt;A&lt;/code&gt;'nın tuttuğu adres (&lt;code&gt;0x100&lt;/code&gt;) kopyalanıyor. &lt;code&gt;A = "Naber!"&lt;/code&gt; çalıştığında ise sadece bu yeni kutu güncelleniyor, metot dışındaki &lt;code&gt;A&lt;/code&gt; hiç etkilenmiyor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Asıl soru: neden ikinci bir referans oluşuyor?
&lt;/h2&gt;

&lt;p&gt;Buradaki gerçek soru "neden string beklenmedik davranıyor" değil. Asıl soru şu: metoda bir referans verildiğinde, C# neden onu olduğu gibi kullanmak yerine bir kopyasını çıkarıyor?&lt;/p&gt;

&lt;p&gt;Cevap: Bu, &lt;code&gt;string&lt;/code&gt; ya da başka bir reference type'a özgü bir istisna değil — &lt;strong&gt;C#'ta parametre geçişinin varsayılan ve tek kuralı bu&lt;/strong&gt;. Metoda ne verilirse verilsin (sayı, string, nesne, fark etmez), çağıranın kutusunun kendisi değil, o kutunun o anki içeriğinin bir kopyası metoda girer. &lt;code&gt;int&lt;/code&gt; için kopyalanan içerik doğrudan sayının kendisi, &lt;code&gt;string&lt;/code&gt;/&lt;code&gt;List&lt;/code&gt; için kopyalanan içerik bir adres — ama kopyalanma kuralı ikisinde de birebir aynı. Yani "referans tipi geçince otomatik bağlantı kurulur" diye bir istisna hiç yok; asıl yanlış varsayım burada.&lt;/p&gt;

&lt;p&gt;Bu tasarımın bir sebebi var. Eğer metoda bir referans verildiğinde metot, çağıranın kutusunun kendisine erişebilseydi, şöyle bir risk her zaman var olurdu:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Guncelle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt; &lt;span class="c1"&gt;// çağıranın değişkenini TAMAMEN BAŞKA bir nesneye çevirebilirdi&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bu otomatik yansısaydı, herhangi bir metoda bir nesne verildiğinde o metodun, çağırandaki değişkeni sessizce başka bir nesneye yönlendirme ihtimali her zaman var olurdu. Kodu okuyan biri her çağrıda "bu metot benim değişkenimi başka bir şeye çevirmiş olabilir mi?" diye düşünmek zorunda kalırdı.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Kutunun kopyalanması bu riski ortadan kaldırıyor.&lt;/strong&gt; Metot kendi parametresini istediği gibi başka adreslere yönlendirebilir, ama bu sadece kendi kopyasını etkiler. Çağıranın hangi nesneye baktığı garanti altında kalır — metodun çağırandaki değişkeni gerçekten yönlendirebilmesi isteniyorsa, bu &lt;code&gt;ref&lt;/code&gt;/&lt;code&gt;out&lt;/code&gt; ile &lt;strong&gt;açıkça&lt;/strong&gt; talep edilmek zorunda. "İkinci referans" bir yan etki değil, bilinçli bir güvenlik/öngörülebilirlik tercihi.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;int&lt;/code&gt; için de aynı kural işliyor
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;TestMetot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;99&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;TestMetot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Heap araya girmiyor ama mekanizma birebir aynı: parametredeki &lt;code&gt;A&lt;/code&gt; kutusu açılıyor, metot dışındaki &lt;code&gt;A&lt;/code&gt;'nın değeri kopyalanıyor, &lt;code&gt;A = 99&lt;/code&gt; sadece kopyayı değiştiriyor. Bu örnek genelde şaşırtmaz, çünkü value type olduğu bilinir — asıl fark string örneğinde "reference type olmasına rağmen" aynı sonucun çıkmasıdır.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bazı örnekler neden çalışıyor gibi görünüyor?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;TestMetot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
&lt;span class="nf"&gt;TestMetot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Count&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Burada da iki ayrı kutu var, ikisi de aynı adresi tutuyor. Fark, metot içinde yapılan işlemde: &lt;code&gt;A.Add(5)&lt;/code&gt; kutunun içeriğini (adresi) değiştirmiyor, kutunun tuttuğu adresteki nesnenin kendisini güncelliyor. İki kutu hâlâ aynı adresi tuttuğu için değişiklik her iki taraftan da görünür.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mutation&lt;/strong&gt; (nesnenin içini değiştirmek): &lt;code&gt;A.Add(...)&lt;/code&gt;, &lt;code&gt;sb.Append(...)&lt;/code&gt; → kutunun içeriğine dokunulmaz, otomatik yansır.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reassignment&lt;/strong&gt; (kutunun içeriğini değiştirmek): &lt;code&gt;A = "Naber!"&lt;/code&gt;, &lt;code&gt;A = new List&amp;lt;int&amp;gt;()&lt;/code&gt; → kutu başka bir adres tutmaya başlar, yansımaz.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;string&lt;/code&gt; immutable olduğu için (&lt;code&gt;Add&lt;/code&gt;, &lt;code&gt;Remove&lt;/code&gt; gibi mutation işlemi yoktur) üzerinde yapılan her işlem zorunlu olarak reassignment'tır — bu yüzden string ile bu tuzağa düşmek çok daha kolaydır.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;ref&lt;/code&gt;/&lt;code&gt;out&lt;/code&gt; ne zaman gerekir?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;TestMetot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ref&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Naber!"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Selam"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;TestMetot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ref&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Naber!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ref&lt;/code&gt; verildiğinde metot ayrı bir kutu açmaz, doğrudan çağıranın kutusuna erişir — o yüzden reassignment de yansır. &lt;code&gt;out&lt;/code&gt; aynı mekanizmayı kullanır, tek farkı: çağıranın başlangıç değeri vermesi gerekmez ama metodun &lt;code&gt;out&lt;/code&gt; parametresine mutlaka bir değer ataması zorunludur, aksi hâlde derleme hatası alınır.&lt;/p&gt;

&lt;h2&gt;
  
  
  Neden önemli?
&lt;/h2&gt;

&lt;p&gt;Bu davranış hiçbir exception fırlatmaz, hiçbir uyarı vermez. Bir metodun bilgi hesaplayıp parametre üzerinden geri döndürmesi beklenen her yerde — loglama, id üretme gibi yardımcı metotlarda — sonuç sessizce hep boş/varsayılan gelir ve fark edilmesi haftalar sürebilir.&lt;/p&gt;

&lt;h2&gt;
  
  
  İlgili konular
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;StringBuilder&lt;/code&gt;&lt;/strong&gt;: string'in mutable karşılığı, &lt;code&gt;.Append()&lt;/code&gt; mevcut nesneyi günceller.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;in&lt;/code&gt; parametresi&lt;/strong&gt;: büyük &lt;code&gt;struct&lt;/code&gt;'ları kopyalamadan, salt-okunur geçirmek için.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Closure'larda değişken yakalama&lt;/strong&gt;: lambda'lar dış değişkeni kutu olarak yakalar, değeri değil — aynı kök mantık.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;record&lt;/code&gt; ve &lt;code&gt;with&lt;/code&gt;&lt;/strong&gt;: immutable tiplerde "değiştirme" aslında yeni nesne üretir, string'in &lt;code&gt;Substring&lt;/code&gt;'ine benzer.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
