<?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>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>
