<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel><title>Hasan Aytaç — Özgün yazılar</title><link>https://hasan-aytac.com/blog/</link><description>Yazılım ve teknoloji üzerine özgün yazılar.</description><language>tr</language><atom:link href="https://hasan-aytac.com/blog/yazilar/rss/" rel="self" type="application/rss+xml"/>
<item><title>C# 2026: Extension Members ile Daha Temiz API Tasarımı</title><link>https://hasan-aytac.com/csharp-2026-extension-members/</link><guid isPermaLink="false">6acdf2abefa82d0001f9e7b9</guid><pubDate>Tue, 13 Oct 2026 08:58:19 +0000</pubDate><description>C# 14 extension bloklarıyla uzantı özellikleri ve statik uzantılar yazın. Derlenip çalıştırılmış .NET 10 örnekleriyle API tasarımını sadeleştirin.</description><content:encoded>&lt;blockquote&gt;&lt;strong&gt;Sürüm notu:&lt;/strong&gt; “C# 2026” resmî bir dil sürümü adı değil, bu rehberin çalışma dönemidir. Örnekler kararlı &lt;strong&gt;.NET 10 ve C# 14&lt;/strong&gt; içindir; önizleme özellikleri kullanılmaz.&lt;/blockquote&gt;&lt;p&gt;Bir müşteri kaydının görünen adını hesaplamak için küçük bir yardımcı metot yazmak kolaydır. Asıl mesele, bu yardımcıların sayısı arttığında çağıran kodun anlaşılır kalmasıdır. &lt;code&gt;CustomerHelpers.GetDisplayName(customer)&lt;/code&gt; yerine &lt;code&gt;customer.DisplayName&lt;/code&gt; okumak, doğru bağlamda daha doğal olabilir.&lt;/p&gt;&lt;p&gt;C# 14’ün &lt;strong&gt;extension members&lt;/strong&gt; özelliği tam olarak bu noktada işe yarar: mevcut bir tipe uzantı metotlarının yanında uzantı özellikleri de ekleyebiliriz. Üstelik yalnızca nesneyi değil, tipin kendisini hedefleyen statik uzantılar da tanımlayabiliriz.&lt;/p&gt;&lt;p&gt;Bu yazıda küçük bir müşteri modeli üzerinden ilerleyelim. Amaç mümkün olan en kısa kodu yazmak değil; neyin gerçek bir üye, neyin uzantı olduğunu bilerek okunaklı bir API oluşturmaktır.&lt;/p&gt;&lt;h2 id&#x3D;&quot;1-ortam%C4%B1-do%C4%9Fru-ayarlay%C4%B1n&quot;&gt;1. Ortamı doğru ayarlayın&lt;/h2&gt;&lt;p&gt;.NET 10 hedefleyen bir konsol projesi oluşturun:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-bash&quot;&gt;dotnet new console -n ExtensionDemo -f net10.0
cd ExtensionDemo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;net10.0&lt;/code&gt; için varsayılan dil sürümü C# 14’tür. Örneklerle aynı ayarı açıkça belirtmek isterseniz proje dosyanız şöyle olabilir:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-xml&quot;&gt;&amp;lt;Project Sdk&#x3D;&quot;Microsoft.NET.Sdk&quot;&amp;gt;
  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;OutputType&amp;gt;Exe&amp;lt;/OutputType&amp;gt;
    &amp;lt;TargetFramework&amp;gt;net10.0&amp;lt;/TargetFramework&amp;gt;
    &amp;lt;LangVersion&amp;gt;14.0&amp;lt;/LangVersion&amp;gt;
    &amp;lt;ImplicitUsings&amp;gt;enable&amp;lt;/ImplicitUsings&amp;gt;
    &amp;lt;Nullable&amp;gt;enable&amp;lt;/Nullable&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;
&amp;lt;/Project&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;LangVersion&#x3D;latest&lt;/code&gt; kullanmak yerine hedef çerçevenin varsayılanına veya belirli bir sürüme bağlı kalın. Böylece geliştirici bilgisayarı ile CI ortamında farklı dil özelliklerinin devreye girmesini önlersiniz.&lt;/p&gt;&lt;h2 id&#x3D;&quot;2-klasik-extension-metodu-h%C3%A2l%C3%A2-ge%C3%A7erli&quot;&gt;2. Klasik extension metodu hâlâ geçerli&lt;/h2&gt;&lt;p&gt;Önce modelimiz:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;namespace CSharp2026.ExtensionMembers;

public sealed record Customer(string FirstName, string LastName);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;C# 14 öncesinde bu modele bir ad biçimlendirme yardımcısı eklemek için ilk parametresinde &lt;code&gt;this&lt;/code&gt; bulunan statik bir metot kullanırdık:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;namespace CSharp2026.ExtensionMembers;

public static class LegacyCustomerExtensions
{
    public static string GetDisplayName(this Customer customer)
    {
        ArgumentNullException.ThrowIfNull(customer);
        return $&quot;{customer.FirstName.Trim()} {customer.LastName.Trim()}&quot;.Trim();
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Bu kod hâlâ desteklenir. Mevcut extension metotlarınızı sırf yeni sözdizimi geldi diye topluca değiştirmeniz gerekmez. Çağıran taraf &lt;code&gt;customer.GetDisplayName()&lt;/code&gt; yazmaya devam edebilir.&lt;/p&gt;&lt;p&gt;Ancak hesaplanan değeri bir özellik olarak sunmak istiyorsanız, yeni extension blokları daha uygun bir ifade biçimi sağlar.&lt;/p&gt;&lt;h2 id&#x3D;&quot;3-bir-extension-blo%C4%9Funda-birden-fazla-%C3%BCye&quot;&gt;3. Bir extension bloğunda birden fazla üye&lt;/h2&gt;&lt;p&gt;Aşağıdaki kodu ayrı bir &lt;code&gt;CustomerExtensions.cs&lt;/code&gt; dosyasına koyun:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;namespace CSharp2026.ExtensionMembers;

public static class CustomerExtensions
{
    extension(Customer customer)
    {
        public string DisplayName
        {
            get
            {
                ArgumentNullException.ThrowIfNull(customer);
                return $&quot;{customer.FirstName.Trim()} {customer.LastName.Trim()}&quot;.Trim();
            }
        }

        public string ToGreeting() &#x3D;&amp;gt; $&quot;Merhaba, {customer.DisplayName}!&quot;;
    }

    extension(Customer)
    {
        public static Customer CreateGuest() &#x3D;&amp;gt; new(&quot;Misafir&quot;, string.Empty);
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;İlk bloktaki &lt;code&gt;customer&lt;/code&gt;, uzantının uygulandığı nesnedir. &lt;code&gt;DisplayName&lt;/code&gt; özellik gibi görünür; &lt;code&gt;ToGreeting()&lt;/code&gt; ise metot gibi çağrılır. İkinci blokta nesne adı bulunmaz: &lt;code&gt;extension(Customer)&lt;/code&gt; doğrudan tipe yönelik statik üyeleri tanımlar.&lt;/p&gt;&lt;p&gt;Kullanımı:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;using CSharp2026.ExtensionMembers;

var customer &#x3D; new Customer(&quot; Ada &quot;, &quot; Lovelace &quot;);
Console.WriteLine(customer.DisplayName);
Console.WriteLine(customer.ToGreeting());
Console.WriteLine(Customer.CreateGuest().DisplayName);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Beklenen çıktı:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-text&quot;&gt;Ada Lovelace
Merhaba, Ada Lovelace!
Misafir
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;CreateGuest()&lt;/code&gt; mevcut &lt;code&gt;Customer&lt;/code&gt; sınıfının kaynak kodunda tanımlı değildir. İlgili namespace kapsamdayken derleyici statik uzantıyı bulur. Her çağrı yeni bir kayıt oluşturur; burada paylaşılan, değiştirilebilir bir global nesne yoktur.&lt;/p&gt;&lt;p&gt;&lt;code&gt;DisplayName&lt;/code&gt; de saklanan bir alan değildir. Her erişimde adları kırpıp sonucu hesaplar. Bu ayrım, özellikle özellik içine pahalı bir veritabanı sorgusu koymayı düşündüğünüzde önemlidir: &lt;strong&gt;basit görünen bir özellik, beklenmedik I/O işlemi saklamamalıdır.&lt;/strong&gt;&lt;/p&gt;&lt;h2 id&#x3D;&quot;4-koleksiyonlara-anlaml%C4%B1-bir-%C3%B6zellik-eklemek&quot;&gt;4. Koleksiyonlara anlamlı bir özellik eklemek&lt;/h2&gt;&lt;p&gt;Uzantı blokları generic tiplerle de kullanılabilir:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;namespace CSharp2026.ExtensionMembers;

public static class CollectionExtensions
{
    extension&amp;lt;T&amp;gt;(IReadOnlyCollection&amp;lt;T&amp;gt; source)
    {
        public bool HasItems
        {
            get
            {
                ArgumentNullException.ThrowIfNull(source);
                return source.Count &amp;gt; 0;
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Örneğin:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;var customers &#x3D; new List&amp;lt;Customer&amp;gt; { new(&quot;Ada&quot;, &quot;Lovelace&quot;) };
Console.WriteLine(customers.HasItems); // True
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Burada özellikle &lt;code&gt;IReadOnlyCollection&amp;lt;T&amp;gt;&lt;/code&gt; seçtik. &lt;code&gt;Count&lt;/code&gt; üzerinden kontrol yapabiliyoruz; diziyi baştan dolaşmamız gerekmiyor. Sadece &lt;code&gt;IEnumerable&amp;lt;T&amp;gt;&lt;/code&gt; kabul edip her erişimde &lt;code&gt;Any()&lt;/code&gt; çağıran bir özellik, kaynağa bağlı olarak yeniden numaralandırma yapabilir. Üyenin adı kadar kabul ettiği arayüz de davranışı belirler.&lt;/p&gt;&lt;p&gt;Bununla birlikte bu örnek, projedeki her koleksiyona &lt;code&gt;HasItems&lt;/code&gt; eklenmesi gerektiği anlamına gelmez. &lt;code&gt;Count &amp;gt; 0&lt;/code&gt; zaten yeterince açıksa ek bir soyutlama gereksiz olabilir.&lt;/p&gt;&lt;h2 id&#x3D;&quot;5-tasar%C4%B1mda-dikkat-edilecek-s%C4%B1n%C4%B1rlar&quot;&gt;5. Tasarımda dikkat edilecek sınırlar&lt;/h2&gt;&lt;p&gt;Extension üyeleri tipe gerçekten yeni alanlar eklemez ve kapsüllemeyi aşmaz. Private üyelere erişim yetkisi vermez; virtual davranışın yerini de almaz. İsim ve imza uyuştuğunda tipin kendi üyesi uzantıdan önceliklidir.&lt;/p&gt;&lt;p&gt;Bir başka önemli nokta &lt;strong&gt;namespace kapsamıdır&lt;/strong&gt;. Gerekli &lt;code&gt;using&lt;/code&gt; yoksa uzantı görünmez. Çok genel bir &lt;code&gt;Extensions&lt;/code&gt; namespace’i, uygulamanın her yerine beklenmedik üyeler yayabilir. Katmana özgü ve açık isimler kullanmak daha sağlıklı bir tercihtir.&lt;/p&gt;&lt;p&gt;Şu ayrımı koruyun:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Kural modelin her kullanımında geçerliyse, kaynak kod sizin kontrolünüzdeyse doğrudan model üyesi düşünün.&lt;/li&gt;&lt;li&gt;Davranış sadece sunum, raporlama veya belirli bir uygulama katmanına aitse uzantı uygun olabilir.&lt;/li&gt;&lt;li&gt;Zaten açık olan bir ifadeyi tek satır kısaltmak için yeni bir API oluşturmayın.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Örnekteki &lt;code&gt;ThrowIfNull&lt;/code&gt;, alıcı nesnenin null olmasını yakalar. Bu, &lt;code&gt;FirstName&lt;/code&gt; ve &lt;code&gt;LastName&lt;/code&gt; için kapsamlı veri doğrulaması değildir. Dışarıdan gelen veriler model oluşturulurken ayrıca doğrulanmalıdır; nullable anotasyonları tek başına çalışma zamanı garantisi sağlamaz.&lt;/p&gt;&lt;h2 id&#x3D;&quot;sonu%C3%A7-yenilikten-%C3%A7ok-niyeti-g%C3%B6r%C3%BCn%C3%BCr-k%C4%B1l%C4%B1n&quot;&gt;Sonuç: yenilikten çok niyeti görünür kılın&lt;/h2&gt;&lt;p&gt;C# 14 extension blokları; ilişkili yardımcı üyeleri bir arada toplamak, hesaplanan değerleri özellik olarak ifade etmek ve statik yardımcıları tip üzerinden çağırmak için kullanışlıdır. Kazanç, yalnızca daha az karakter yazmak değil, çağıran kodda &lt;strong&gt;niyetin daha kolay okunmasıdır&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href&#x3D;&quot;https://hasan-aytac.com/content/files/2026/10/csharp-2026-code-samples.zip&quot;&gt;Üç makalenin çalıştırılabilir kod örneklerini indir — ZIP&lt;/a&gt;. Bu makalenin &lt;code&gt;ExtensionMembers&lt;/code&gt; projesinde normal kullanım, boş koleksiyon, klasik sözdizimi ve null alıcı davranışı için yedi doğrulama bulunur.&lt;/p&gt;&lt;h2 id&#x3D;&quot;kaynaklar-ve-devam%C4%B1&quot;&gt;Kaynaklar ve devamı&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href&#x3D;&quot;https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-14?ref&#x3D;hasan-aytac.com&quot;&gt;Microsoft Learn — C# 14 yenilikleri&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href&#x3D;&quot;https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods?ref&#x3D;hasan-aytac.com&quot;&gt;Microsoft Learn — Extension members&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href&#x3D;&quot;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version?ref&#x3D;hasan-aytac.com&quot;&gt;Microsoft Learn — Dil sürümünü yapılandırma&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Serinin ikinci yazısı: &lt;a href&#x3D;&quot;https://hasan-aytac.com/csharp-2026-field-null-conditional-assignment/&quot;&gt;field ve null-conditional assignment&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Serinin üçüncü yazısı: &lt;a href&#x3D;&quot;https://hasan-aytac.com/csharp-2026-async-streams-cancellation/&quot;&gt;async streams ve cancellation&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;em&gt;Bu yazı yapay zekâ desteğiyle hazırlanmıştır. İndirilebilir örnekler .NET SDK 10.0.401 üzerinde, C# 14 ayarı ve uyarıları hata kabul eden yapılandırmayla derlenip çalıştırılmıştır.&lt;/em&gt;&lt;/p&gt;</content:encoded><category>csharp</category><category>dotnet</category><category>programming</category><category>C# 2026</category></item>
<item><title>C# 2026: field ve Null-Conditional Assignment ile Güvenli Modeller</title><link>https://hasan-aytac.com/csharp-2026-field-null-conditional-assignment/</link><guid isPermaLink="false">6acdf2abefa82d0001f9e7af</guid><pubDate>Tue, 13 Oct 2026 08:58:19 +0000</pubDate><description>C# 14 field anahtar sözcüğüyle doğrulanan özellikler oluşturun; ?. atamalarının ne zaman çalıştığını ve nerede kullanılmaması gerektiğini örneklerle öğrenin.</description><content:encoded>&lt;blockquote&gt;&lt;strong&gt;Sürüm notu:&lt;/strong&gt; Bu rehberdeki “2026” bir yıl ifadesidir. Aşağıdaki iki dil özelliği &lt;strong&gt;C# 14&lt;/strong&gt; ile gelir; örnekler &lt;strong&gt;.NET 10&lt;/strong&gt; üzerinde çalışır.&lt;/blockquote&gt;&lt;p&gt;Bir özellik atandığında boşlukları temizlemek, negatif fiyatı reddetmek veya isteğe bağlı bir nesneye not eklemek sıradan işlerdir. Fakat bu küçük işler, modellerde tekrar eden backing field’lara ve uzayan null kontrollerine dönüşebilir.&lt;/p&gt;&lt;p&gt;C# 14 iki faydalı araç sunuyor: özellik erişimcilerinde &lt;code&gt;field&lt;/code&gt; kullanımı ve atamanın sol tarafında null-conditional erişim. İkisi de kodu sadeleştirir; ancak doğrulama sorumluluğunu ortadan kaldırmaz.&lt;/p&gt;&lt;p&gt;Bu yazıda bir ürün modeli ve sipariş taslağı üzerinden hem normal akışı hem de hatalı girdilerin davranışını ele alacağız.&lt;/p&gt;&lt;h2 id&#x3D;&quot;1-field-tam-olarak-neyi-de%C4%9Fi%C5%9Ftiriyor&quot;&gt;1. field tam olarak neyi değiştiriyor?&lt;/h2&gt;&lt;p&gt;Klasik yaklaşımda doğrulama yapan bir özellik için özel bir alan tanımlarız:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;private string _name &#x3D; &quot;Adsız ürün&quot;;

public string Name
{
    get &#x3D;&amp;gt; _name;
    set
    {
        if (string.IsNullOrWhiteSpace(value))
            throw new ArgumentException(&quot;Ürün adı boş olamaz.&quot;, nameof(value));

        _name &#x3D; value.Trim();
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;C# 14’te derleyicinin oluşturduğu backing field’a, erişimci içindeki &lt;code&gt;field&lt;/code&gt; anahtar sözcüğüyle ulaşabiliriz. Böylece yalnızca alan bildirimini ve onu döndüren basit getter’ı kaldırırız; iş kuralı aynı yerde görünür kalır.&lt;/p&gt;&lt;p&gt;Bu özellik, &lt;code&gt;field&lt;/code&gt; adlı bir değişken oluşturmanız anlamına gelmez. Bağlama duyarlı anahtar sözcük, ilgili özelliğin derleyici tarafından üretilen depolama alanını ifade eder.&lt;/p&gt;&lt;h2 id&#x3D;&quot;2-do%C4%9Frulanan-bir-%C3%BCr%C3%BCn-modeli&quot;&gt;2. Doğrulanan bir ürün modeli&lt;/h2&gt;&lt;p&gt;.NET 10 konsol projesindeki ayrı bir &lt;code&gt;Product.cs&lt;/code&gt; dosyası şöyle olabilir:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;namespace CSharp2026.SafeModels;

public sealed class Product
{
    public string Name
    {
        get;
        set
        {
            if (string.IsNullOrWhiteSpace(value))
                throw new ArgumentException(&quot;Ürün adı boş olamaz.&quot;, nameof(value));

            field &#x3D; value.Trim();
        }
    } &#x3D; &quot;Adsız ürün&quot;;

    public decimal Price
    {
        get;
        set &#x3D;&amp;gt; field &#x3D; value &amp;gt;&#x3D; 0
            ? value
            : throw new ArgumentOutOfRangeException(nameof(value), &quot;Fiyat negatif olamaz.&quot;);
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Burada iki kural var: ürün adı boş bırakılamaz ve fiyat negatif olamaz. Örneğin:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;using CSharp2026.SafeModels;

var product &#x3D; new Product
{
    Name &#x3D; &quot;  Klavye  &quot;,
    Price &#x3D; 1250m
};

Console.WriteLine(product.Name);  // Klavye
Console.WriteLine(product.Price); // 1250
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;get;&lt;/code&gt; otomatik getter’dır. Setter ise değeri doğrulayıp &lt;code&gt;field&lt;/code&gt; alanına yazar. Getter ve setter’ı tek bir özellik içinde okuyarak saklanan değerin nereden geldiğini anlayabiliriz.&lt;/p&gt;&lt;p&gt;Başlangıç değerlerine de dikkat edin. &lt;code&gt;Name&lt;/code&gt; için geçerli bir varsayılan metin verdik; &lt;code&gt;Price&lt;/code&gt; için decimal’in varsayılanı olan sıfır geçerlidir. Property initializer, setter’ı çağırarak doğrulama yapmaz; backing field’ı başlatır. Bu nedenle başlangıç değerini de sizin doğru seçmeniz gerekir.&lt;/p&gt;&lt;p&gt;Gerçek uygulamanızda ücretsiz ürün kabul edilmiyorsa &lt;code&gt;value &amp;gt;&#x3D; 0&lt;/code&gt; yeterli değildir. Para birimi, hassasiyet ve yuvarlama gibi finansal kurallar da bu basit örneğin dışındadır. &lt;strong&gt;Kısa sözdizimi, domain modelinin tamamlandığı anlamına gelmez.&lt;/strong&gt;&lt;/p&gt;&lt;h2 id&#x3D;&quot;3-hatal%C4%B1-atama-mevcut-de%C4%9Feri-bozmamal%C4%B1&quot;&gt;3. Hatalı atama mevcut değeri bozmamalı&lt;/h2&gt;&lt;p&gt;Doğrulamayı &lt;code&gt;field&lt;/code&gt; atamasından önce yapmak önemlidir:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;try
{
    product.Price &#x3D; -1m;
}
catch (ArgumentOutOfRangeException)
{
    Console.WriteLine(product.Price); // 1250
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Setter önce koşulu kontrol eder. Geçersiz değer geldiğinde istisna oluşur, dolayısıyla eski fiyat korunur. Aynı davranış boş ürün adı için de geçerlidir.&lt;/p&gt;&lt;p&gt;Bu, testlerde özellikle kontrol edilmesi gereken bir ayrıntıdır. Sadece “istisna fırlattı mı?” sorusu yetmez; nesnenin hatadan sonra hangi durumda kaldığını da doğrulamalısınız.&lt;/p&gt;&lt;p&gt;Setter içine uzak servis çağrısı, dosya erişimi veya kapsamlı iş akışı koymak ise hâlâ kötü bir sürpriz yaratabilir. Bir özelliği atamak ucuz ve öngörülebilir olmalıdır. Daha karmaşık işlemler için niyeti açık bir metot tercih edin.&lt;/p&gt;&lt;h2 id&#x3D;&quot;4-null-conditional-assignment-nas%C4%B1l-%C3%A7al%C4%B1%C5%9F%C4%B1r&quot;&gt;4. Null-conditional assignment nasıl çalışır?&lt;/h2&gt;&lt;p&gt;Sipariş taslağı modelimiz:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;namespace CSharp2026.SafeModels;

public sealed class OrderDraft
{
    public string? Note { get; set; }
    public int Quantity { get; set; }
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;C# 14 öncesinde isteğe bağlı bir taslağa not atarken çoğunlukla &lt;code&gt;if (draft is not null)&lt;/code&gt; bloğu yazardık. Artık &lt;code&gt;?.&lt;/code&gt; atamanın sol tarafında kullanılabilir:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;OrderDraft? draft &#x3D; null;
int calls &#x3D; 0;

draft?.Note &#x3D; BuildNote();
Console.WriteLine($&quot;Null taslakta çağrı sayısı: {calls}&quot;);

draft &#x3D; new OrderDraft();
draft?.Note &#x3D; BuildNote();
draft?.Quantity +&#x3D; 1;
Console.WriteLine($&quot;Dolu taslakta çağrı sayısı: {calls}&quot;);
Console.WriteLine($&quot;Adet: {draft?.Quantity}&quot;);

string BuildNote()
{
    calls++;
    return &quot;Kapıya teslim&quot;;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Beklenen çıktı:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-text&quot;&gt;Null taslakta çağrı sayısı: 0
Dolu taslakta çağrı sayısı: 1
Adet: 1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Buradaki kritik nokta, yalnızca atamanın atlanması değildir. &lt;strong&gt;Alıcı null olduğunda sağ taraftaki ifade de değerlendirilmez.&lt;/strong&gt; İlk satırdaki &lt;code&gt;BuildNote()&lt;/code&gt; hiç çağrılmaz. Bu davranış, not üretmenin pahalı olduğu veya başka bir yan etki oluşturduğu durumlarda önem kazanır.&lt;/p&gt;&lt;p&gt;Bileşik atamalar da desteklenir: &lt;code&gt;draft?.Quantity +&#x3D; 1&lt;/code&gt; kullanılabilir. Fakat &lt;code&gt;draft?.Quantity++&lt;/code&gt; ve &lt;code&gt;draft?.Quantity--&lt;/code&gt; bu özelliğin desteklediği biçimler değildir. Örnekleri birbirine eşdeğer sanarak değiştirmeyin.&lt;/p&gt;&lt;h2 id&#x3D;&quot;5-k%C4%B1sa-yazmak-her-zaman-do%C4%9Fru-davran%C4%B1%C5%9F-de%C4%9Fildir&quot;&gt;5. Kısa yazmak her zaman doğru davranış değildir&lt;/h2&gt;&lt;p&gt;Null-conditional assignment, &lt;strong&gt;null olduğunda hiçbir şey yapılmaması gerçekten doğruysa&lt;/strong&gt; uygundur. İsteğe bağlı bir ekran ayarı, henüz oluşmamış bir önizleme nesnesi veya yardımcı görüntüleme durumu buna örnek olabilir.&lt;/p&gt;&lt;p&gt;Fakat sipariş tamamlama gibi bir işlemde taslağın bulunması zorunluysa, sessizce atlamak hatayı saklar. Böyle bir durumda açık kontrol daha doğru olur:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;ArgumentNullException.ThrowIfNull(draft);
draft.Note &#x3D; &quot;Onay için hazır&quot;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Ayrıca &lt;code&gt;?.&lt;/code&gt; thread safety sağlamaz. Paylaşılan nesnede &lt;code&gt;Quantity +&#x3D; 1&lt;/code&gt; işlemini atomik hâle getirmez; eşzamanlılık için kilit, uygun atomik işlemler veya farklı bir durum yönetimi yaklaşımı gerekebilir.&lt;/p&gt;&lt;p&gt;Nullable reference types da bu resmin sadece bir parçasıdır. Anotasyonlar, derleyicinin olası null kullanımını raporlamasına yardımcı olur; dış sistemlerden gelen hatalı verilerin var olmayacağını garanti etmez. Giriş sınırlarında doğrulama yapmayı sürdürün.&lt;/p&gt;&lt;h2 id&#x3D;&quot;6-projeye-ta%C5%9F%C4%B1madan-%C3%B6nce-kontrol-listesi&quot;&gt;6. Projeye taşımadan önce kontrol listesi&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Hedef çerçeveniz &lt;code&gt;net10.0&lt;/code&gt;, dil sürümünüz C# 14 mü?&lt;/li&gt;&lt;li&gt;Varsayılan özellik değerleri domain kurallarına uygun mu?&lt;/li&gt;&lt;li&gt;Geçersiz atama sonrasında eski değer korunuyor mu?&lt;/li&gt;&lt;li&gt;Null durumunda işlemin atlanması gerçekten istenen davranış mı?&lt;/li&gt;&lt;li&gt;Sınıfınızda zaten &lt;code&gt;field&lt;/code&gt; adlı bir üye varsa anlam karışıklığı oluşuyor mu?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Son maddede gerekirse mevcut üyeyi yeniden adlandırın. &lt;code&gt;@field&lt;/code&gt; veya &lt;code&gt;this.field&lt;/code&gt;, mevcut bir üye ile yeni anahtar sözcüğü ayırt etmeye yardımcı olabilir. Bu özellikle eski kodları yeni derleyiciyle derlerken gözden geçirilmelidir.&lt;/p&gt;&lt;h2 id&#x3D;&quot;sonu%C3%A7-sade-kod-a%C3%A7%C4%B1k-kurallar&quot;&gt;Sonuç: sade kod, açık kurallar&lt;/h2&gt;&lt;p&gt;&lt;code&gt;field&lt;/code&gt;, doğrulanan özelliklerde gereksiz alan tekrarını azaltır. Null-conditional assignment ise isteğe bağlı nesneler için kontrol akışını sadeleştirir. İkisinin de değeri, kodun niyetini görünür kılmalarıdır; zorunlu kontrolleri gizlemeleri değil.&lt;/p&gt;&lt;p&gt;&lt;a href&#x3D;&quot;https://hasan-aytac.com/content/files/2026/10/csharp-2026-code-samples.zip&quot;&gt;Çalıştırılabilir kod örneklerini indir — ZIP&lt;/a&gt;. &lt;code&gt;SafeModels&lt;/code&gt; projesi ad temizleme, geçersiz girdiler, eski değerin korunması ve null atamalardaki yan etkiler için on doğrulama içerir.&lt;/p&gt;&lt;h2 id&#x3D;&quot;kaynaklar-ve-devam%C4%B1&quot;&gt;Kaynaklar ve devamı&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href&#x3D;&quot;https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-14?ref&#x3D;hasan-aytac.com#the-field-keyword&quot;&gt;Microsoft Learn — C# 14: field anahtar sözcüğü&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href&#x3D;&quot;https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-14?ref&#x3D;hasan-aytac.com#null-conditional-assignment&quot;&gt;Microsoft Learn — C# 14: null-conditional assignment&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href&#x3D;&quot;https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references?ref&#x3D;hasan-aytac.com&quot;&gt;Microsoft Learn — Nullable reference types&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Önceki yazı: &lt;a href&#x3D;&quot;https://hasan-aytac.com/csharp-2026-extension-members/&quot;&gt;Extension Members ile API tasarımı&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Sonraki yazı: &lt;a href&#x3D;&quot;https://hasan-aytac.com/csharp-2026-async-streams-cancellation/&quot;&gt;Async Streams ve Cancellation&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;em&gt;Bu yazı yapay zekâ desteğiyle hazırlanmıştır. İndirilebilir örnekler .NET SDK 10.0.401 üzerinde, C# 14 ayarı ve uyarıları hata kabul eden yapılandırmayla derlenip çalıştırılmıştır.&lt;/em&gt;&lt;/p&gt;</content:encoded><category>csharp</category><category>dotnet</category><category>programming</category><category>C# 2026</category></item>
<item><title>C# 2026: Async Streams ve Cancellation ile Akış İşleme</title><link>https://hasan-aytac.com/csharp-2026-async-streams-cancellation/</link><guid isPermaLink="false">6acdf2abefa82d0001f9e7a1</guid><pubDate>Tue, 13 Oct 2026 08:58:19 +0000</pubDate><description>IAsyncEnumerable, await foreach ve CancellationToken ile sayfalı verileri işleyin. .NET 10 üzerinde çalışan örneklerle iptal, hata ve kaynak yönetimini anlayın.</description><content:encoded>&lt;blockquote&gt;&lt;strong&gt;Sürüm notu:&lt;/strong&gt; Örnekler 2026’da kararlı bir hedef olan &lt;strong&gt;.NET 10 / C# 14&lt;/strong&gt; üzerinde çalışır. &lt;code&gt;IAsyncEnumerable&amp;lt;T&amp;gt;&lt;/code&gt; ve &lt;code&gt;await foreach&lt;/code&gt;, C# 14 yeniliği değildir; C# 8 döneminden beri kullanılan araçlardır.&lt;/blockquote&gt;&lt;p&gt;Binlerce siparişi sayfa sayfa okuyan bir uygulama düşünün. Bütün sayfaları bir listeye ekleyip işlemeyi en sona bırakmak kolaydır; fakat ilk sonucu görmek için tüm sorguların bitmesini bekler ve elde edilen veriyi bellekte tutarsınız.&lt;/p&gt;&lt;p&gt;Async streams, tüketicinin veriler hazır oldukça çalışmasını sağlar. Doğru kullanıldığında hem kontrol akışını hem de kaynak yönetimini anlaşılır hâle getirir. Ama tek başına paralellik, sınırsız performans veya otomatik iptal garantisi vermez.&lt;/p&gt;&lt;p&gt;Bu yazıda dış bir servise bağlanmadan çalışan bir sipariş akışı oluşturacağız. Ardından bu akışı nasıl iptal edeceğimizi ve hataları nerede yakalamamız gerektiğini göreceğiz.&lt;/p&gt;&lt;h2 id&#x3D;&quot;1-hangi-d%C3%B6n%C3%BC%C5%9F-tipini-se%C3%A7melisiniz&quot;&gt;1. Hangi dönüş tipini seçmelisiniz?&lt;/h2&gt;
&lt;!--kg-card-begin: html--&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;İhtiyaç&lt;/th&gt;
&lt;th&gt;Yaygın tercih&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;Tek bir asenkron sonuç&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Task&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bütün sonuçlara birlikte ihtiyaç var&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Task&amp;lt;List&amp;lt;T&amp;gt;&amp;gt;&lt;/code&gt; veya benzer bir koleksiyon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sonuçları hazır oldukça işlemek gerekiyor&lt;/td&gt;
&lt;td&gt;&lt;code&gt;IAsyncEnumerable&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;!--kg-card-end: html--&gt;
&lt;p&gt;Hiçbiri her durumda diğerinden üstün değildir. Küçük bir veri kümesinde tüm listeyi almak daha basit olabilir. Sayfalı API, uzun süren rapor veya sürekli üretilen olay akışında ise &lt;code&gt;IAsyncEnumerable&amp;lt;T&amp;gt;&lt;/code&gt; anlamlı bir seçenek hâline gelir.&lt;/p&gt;&lt;p&gt;Buradaki ayrım, sadece dönüş tipini değiştirmek değildir. Tüketici artık “bütün iş tamamlandı mı?” yerine “bir sonraki kayıt hazır mı?” sorusunu sorar.&lt;/p&gt;&lt;h2 id&#x3D;&quot;2-sayfalar%C4%B1-s%C4%B1rayla-%C3%BCreten-bir-ak%C4%B1%C5%9F&quot;&gt;2. Sayfaları sırayla üreten bir akış&lt;/h2&gt;&lt;p&gt;.NET 10 konsol projesinde aşağıdaki &lt;code&gt;OrderReader.cs&lt;/code&gt; dosyasını oluşturun:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;using System.Runtime.CompilerServices;

namespace CSharp2026.AsyncStreams;

public sealed record Order(int Id, decimal Total);

public static class OrderReader
{
    public static async IAsyncEnumerable&amp;lt;Order&amp;gt; ReadAsync(
        [EnumeratorCancellation] CancellationToken cancellationToken &#x3D; default)
    {
        for (int page &#x3D; 1; page &amp;lt;&#x3D; 3; page++)
        {
            cancellationToken.ThrowIfCancellationRequested();
            var orders &#x3D; await LoadPageAsync(page, cancellationToken);

            foreach (var order in orders)
            {
                cancellationToken.ThrowIfCancellationRequested();
                yield return order;
            }
        }
    }

    private static async Task&amp;lt;IReadOnlyList&amp;lt;Order&amp;gt;&amp;gt; LoadPageAsync(
        int page, CancellationToken cancellationToken)
    {
        // Ağ/veritabanı beklemesini taklit eder; dış sisteme bağlanmaz.
        await Task.Delay(10, cancellationToken);
        return [new Order(page * 10 + 1, 100m), new Order(page * 10 + 2, 200m)];
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Bu örnek üç sayfa üretir; her sayfada iki sipariş vardır. &lt;code&gt;Task.Delay&lt;/code&gt;, ağ veya veritabanı beklemesini taklit eder. Gerçek bir dış sisteme istek yapılmaz.&lt;/p&gt;&lt;p&gt;Akışın önemli noktaları:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;async&lt;/code&gt; ile &lt;code&gt;yield return&lt;/code&gt; birlikte kullanılır.&lt;/li&gt;&lt;li&gt;Bir sayfa hazır olduğunda içindeki kayıtlar tüketiciye sırayla sunulur.&lt;/li&gt;&lt;li&gt;Sonraki sayfa, mevcut sayfanın kayıtları tüketildikten sonra istenir.&lt;/li&gt;&lt;li&gt;İptal hem bekleme işlemine iletilir hem de kayıtların arasında kontrol edilir.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Üretici, bütün siparişleri biriktiren ortak bir liste oluşturmaz. Yine de o anki sayfa bellektedir. Dolayısıyla “stream kullanınca hiç bellek tüketilmez” demek yanlış olur; bellek ihtiyacı sayfa boyutuna ve tüketicinin ne yaptığına bağlıdır.&lt;/p&gt;&lt;h2 id&#x3D;&quot;3-await-foreach-ile-t%C3%BCketmek&quot;&gt;3. await foreach ile tüketmek&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Program.cs&lt;/code&gt; içindeki ana akış:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;using CSharp2026.AsyncStreams;
&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-csharp&quot;&gt;using var timeout &#x3D; new CancellationTokenSource(TimeSpan.FromSeconds(5));
int count &#x3D; 0;
decimal total &#x3D; 0;

try
{
    await foreach (var order in OrderReader.ReadAsync().WithCancellation(timeout.Token))
    {
        count++;
        total +&#x3D; order.Total;
        Console.WriteLine($&quot;Sipariş {order.Id}: {order.Total}&quot;);
    }
    Console.WriteLine($&quot;İşlenen: {count}; toplam: {total}&quot;);
}
catch (OperationCanceledException) when (timeout.IsCancellationRequested)
{
    Console.WriteLine(&quot;İşlem iptal edildi veya süre doldu.&quot;);
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Normal koşullarda çıktı şöyle olur:&lt;/p&gt;&lt;pre&gt;&lt;code class&#x3D;&quot;language-text&quot;&gt;Sipariş 11: 100
Sipariş 12: 200
Sipariş 21: 100
Sipariş 22: 200
Sipariş 31: 100
Sipariş 32: 200
İşlenen: 6; toplam: 900
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Örnekte beş saniyelik süre sınırı var. Veri üretimi çok kısa olduğu için normal çalışmada tüm kayıtlar işlenir. Gerçek bir ağ işlemi takıldığında veya kullanıcı iptal istediğinde aynı mekanizma akışın durdurulmasına yardım eder.&lt;/p&gt;&lt;p&gt;&lt;code&gt;await foreach&lt;/code&gt; burada kayıtları &lt;strong&gt;sırayla&lt;/strong&gt; işler. İçine &lt;code&gt;await SaveAsync(order)&lt;/code&gt; koyarsanız bir siparişin kaydı tamamlanmadan bir sonrakine geçilmez. Bu, çoğu zaman istenen davranıştır. Paralellik gerekiyorsa onu ayrıca ve sınırlandırılmış biçimde tasarlamalısınız; her kayıt için kontrolsüz bir task başlatmak iyi bir çözüm değildir.&lt;/p&gt;&lt;h2 id&#x3D;&quot;4-withcancellation-neden-tek-ba%C5%9F%C4%B1na-yeterli-de%C4%9Fil&quot;&gt;4. WithCancellation neden tek başına yeterli değil?&lt;/h2&gt;&lt;p&gt;&lt;code&gt;WithCancellation(token)&lt;/code&gt;, token’ı enumerator oluşturulurken iletir. Üreticinin bu token’ı gerçekten kullanması gerekir.&lt;/p&gt;&lt;p&gt;Async iterator’daki &lt;code&gt;[EnumeratorCancellation]&lt;/code&gt; niteliği, tüketiciden gelen token’ın iterator gövdesindeki parametreye ulaşmasını sağlar. Üretici hem parametreyle hem numaralandırma yoluyla token alıyorsa derleyici bunları uygun şekilde birleştirebilir.&lt;/p&gt;&lt;p&gt;Ancak bu bağlantı, iptali bütün işlemler için sihirli biçimde etkinleştirmez. Aşağıdaki adımlar hâlâ sizin sorumluluğunuzdadır:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Token’ı &lt;code&gt;HttpClient&lt;/code&gt;, veritabanı veya diğer asenkron çağrılara iletmek.&lt;/li&gt;&lt;li&gt;Uzun CPU işlemlerinde uygun aralıklarla iptali kontrol etmek.&lt;/li&gt;&lt;li&gt;İptali genel bir hata gibi yutup devam etmemek.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Örnekte &lt;code&gt;Task.Delay(10, cancellationToken)&lt;/code&gt; bu zincirin bekleme tarafını, &lt;code&gt;ThrowIfCancellationRequested()&lt;/code&gt; ise kayıtlar arasındaki kontrolü gösterir.&lt;/p&gt;&lt;p&gt;&lt;code&gt;catch&lt;/code&gt; filtresine de dikkat edin. Kendi token’ımızın iptal edildiği durumda beklenen iptal mesajını gösteriyoruz. Farklı bir işlemden gelen her &lt;code&gt;OperationCanceledException&lt;/code&gt; otomatik olarak “kullanıcı iptal etti” anlamına gelmez.&lt;/p&gt;&lt;h2 id&#x3D;&quot;5-hatalar-ne-zaman-ortaya-%C3%A7%C4%B1kar&quot;&gt;5. Hatalar ne zaman ortaya çıkar?&lt;/h2&gt;&lt;p&gt;Bir async iterator metodu çağırmak, tüm veriyi hemen okumaz. Asıl iş numaralandırma başladığında yürür. Bu nedenle yalnızca &lt;code&gt;ReadAsync()&lt;/code&gt; çağrısını &lt;code&gt;try&lt;/code&gt; içine almak yeterli değildir; &lt;strong&gt;&lt;code&gt;await foreach&lt;/code&gt; döngüsünü de kapsamalısınız.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Akış üçüncü sayfada hata verirse ilk iki sayfadaki kayıtlar zaten işlenmiş olabilir. Bu durum iş mantığınız açısından önemlidir. Rapor üretmek ile ödeme işlemi yapmak aynı hata stratejisine sahip olamaz.&lt;/p&gt;&lt;p&gt;Kalıcı yan etkiler varsa şu soruları baştan yanıtlayın:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Aynı kayıt yeniden işlenirse sonuç güvenli mi?&lt;/li&gt;&lt;li&gt;İşlem nereden devam edecek?&lt;/li&gt;&lt;li&gt;Kısmi başarı kullanıcıya nasıl bildirilecek?&lt;/li&gt;&lt;li&gt;Hangi hatalar tekrar denenebilir, hangileri kalıcıdır?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Bütün akışı baştan tekrar etmek, daha önce işlenen kayıtların etkilerini çoğaltabilir. Retry uygulamak tek başına idempotency sağlamaz. Kayıt kimliği, checkpoint veya işlemin niteliğine uygun başka bir mekanizma gerekebilir.&lt;/p&gt;&lt;h2 id&#x3D;&quot;6-kaynak-y%C3%B6netimi-ve-%C3%BCretim-ortam%C4%B1&quot;&gt;6. Kaynak yönetimi ve üretim ortamı&lt;/h2&gt;&lt;p&gt;&lt;code&gt;await foreach&lt;/code&gt;, döngü tamamlandığında, hata oluştuğunda veya &lt;code&gt;break&lt;/code&gt; ile çıkıldığında enumerator’ı asenkron biçimde dispose eder. Bu, akışı durdurmanın kaynaklar açısından önemli bir parçasıdır; yine de üretici açtığı kaynakları doğru yönetmelidir.&lt;/p&gt;&lt;p&gt;Bir veritabanı reader’ı veya ağ kaynağı kullanıyorsanız yaşam süresini &lt;code&gt;using&lt;/code&gt; / &lt;code&gt;await using&lt;/code&gt; ile uygun kapsamda tutun. Akış henüz tüketilmeden gereken kaynağı kapatmak, daha sonra ortaya çıkan hatalara yol açabilir.&lt;/p&gt;&lt;p&gt;Örnekteki sabit üç sayfa yalnızca öğretim amaçlıdır. Gerçek bir serviste &lt;code&gt;hasNextPage&lt;/code&gt;, cursor veya boş sayfa gibi bitiş koşullarını uygulayın. Tekrarlayan cursor’lara, tutarlı sıralamaya, zaman aşımına ve gerekirse toplam sayfa sınırına dikkat edin.&lt;/p&gt;&lt;p&gt;Son olarak tüketici bütün sonuçları yeniden bir listeye toplarsa, akışın bellek avantajı büyük ölçüde kaybolabilir. Aracı değil, uçtan uca veri işleme biçimini değerlendirin.&lt;/p&gt;&lt;h2 id&#x3D;&quot;sonu%C3%A7-ak%C4%B1%C5%9F-iptal-ve-yan-etkileri-birlikte-tasarlay%C4%B1n&quot;&gt;Sonuç: akış, iptal ve yan etkileri birlikte tasarlayın&lt;/h2&gt;&lt;p&gt;Async streams’in en güçlü yanı, veriler hazır oldukça işlemeyi açık bir programlama modeliyle sunmasıdır. Sağlam bir çözüm için buna iptal zinciri, kaynak yaşam süresi ve kısmi başarı stratejisi de eklenmelidir.&lt;/p&gt;&lt;p&gt;&lt;a href&#x3D;&quot;https://hasan-aytac.com/content/files/2026/10/csharp-2026-code-samples.zip&quot;&gt;Üç makalenin kod örneklerini indir — ZIP&lt;/a&gt;. &lt;code&gt;AsyncStreams&lt;/code&gt; projesi kayıt sayısını, toplamı, sıralamayı, ilk kayıttan sonraki iptali ve önceden iptal edilmiş token davranışını altı doğrulamayla sınar.&lt;/p&gt;&lt;h2 id&#x3D;&quot;kaynaklar-ve-devam%C4%B1&quot;&gt;Kaynaklar ve devamı&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href&#x3D;&quot;https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/generate-consume-asynchronous-stream?ref&#x3D;hasan-aytac.com&quot;&gt;Microsoft Learn — Async stream üretmek ve tüketmek&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href&#x3D;&quot;https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1?ref&#x3D;hasan-aytac.com&quot;&gt;Microsoft Learn — IAsyncEnumerable&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href&#x3D;&quot;https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.enumeratorcancellationattribute?ref&#x3D;hasan-aytac.com&quot;&gt;Microsoft Learn — EnumeratorCancellationAttribute&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Serinin ilk yazısı: &lt;a href&#x3D;&quot;https://hasan-aytac.com/csharp-2026-extension-members/&quot;&gt;C# 14 Extension Members&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Serinin ikinci yazısı: &lt;a href&#x3D;&quot;https://hasan-aytac.com/csharp-2026-field-null-conditional-assignment/&quot;&gt;field ve null-conditional assignment&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;em&gt;Bu yazı yapay zekâ desteğiyle hazırlanmıştır. İndirilebilir örnekler .NET SDK 10.0.401 üzerinde, C# 14 ayarı ve uyarıları hata kabul eden yapılandırmayla derlenip çalıştırılmıştır.&lt;/em&gt;&lt;/p&gt;</content:encoded><category>csharp</category><category>dotnet</category><category>programming</category><category>C# 2026</category></item>
<item><title>The Story Behind Hasan Aytaç: Innovating Through Code and Creativity</title><link>https://hasan-aytac.com/the-story-of-hasan-aytac/</link><guid isPermaLink="false">6acd5e1936affa0001e1025a</guid><pubDate>Tue, 28 Jan 2025 00:00:00 +0000</pubDate><description>Discover the story of Hasan Aytaç, a skilled software developer who combines technical expertise with creativity to deliver innovative solutions. Explore his journey, accomplishments, and vision for the future.</description><content:encoded>
&lt;!--kg-card-begin: html--&gt;
&lt;h2 id&#x3D;&quot;hasan-aytaç-the-developer-behind-the-code&quot;&gt;Hasan Aytaç: The Developer Behind the Code&lt;/h2&gt;
&lt;p&gt;In today’s rapidly evolving tech landscape, staying ahead requires more than just technical knowledge—it demands adaptability, creativity, and a commitment to lifelong learning. Meet Hasan Aytaç, a professional software developer with an eye for detail, a mind for problem-solving, and a heart for innovation.&lt;/p&gt;
&lt;h3 id&#x3D;&quot;a-professional-journey-defined-by-excellence&quot;&gt;A Professional Journey Defined by Excellence&lt;/h3&gt;
&lt;p&gt;Hasan’s journey into the world of software development started with a curiosity for how things work and an ambition to build something meaningful. Over the years, he has amassed experience across various technologies, frameworks, and domains, excelling at creating user-centric applications and scalable solutions.&lt;/p&gt;
&lt;h4 id&#x3D;&quot;technical-expertise&quot;&gt;&lt;strong&gt;Technical Expertise&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;Hasan specializes in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Frontend Development&lt;/strong&gt;: Utilizing frameworks like &lt;strong&gt;Astro&lt;/strong&gt;, &lt;strong&gt;React&lt;/strong&gt;, and &lt;strong&gt;React Native Expo&lt;/strong&gt; to craft responsive, engaging user interfaces.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Backend Development&lt;/strong&gt;: Building robust APIs and backend logic with &lt;strong&gt;C#&lt;/strong&gt;, &lt;strong&gt;ASP.NET&lt;/strong&gt;, and &lt;strong&gt;Node.js&lt;/strong&gt; to ensure seamless performance.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Architecture &amp;amp; Design&lt;/strong&gt;: Adopting &lt;strong&gt;Clean Architecture&lt;/strong&gt; principles to maintain scalable, maintainable, and testable codebases.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DevOps&lt;/strong&gt;: Proficient in deploying and maintaining applications using &lt;strong&gt;Vercel&lt;/strong&gt;, &lt;strong&gt;Netlify&lt;/strong&gt;, and &lt;strong&gt;IIS&lt;/strong&gt;, with a focus on performance optimization and security.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id&#x3D;&quot;notable-projects&quot;&gt;&lt;strong&gt;Notable Projects&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;Here are a few standout projects from Hasan’s portfolio:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Real-Time Delivery Optimization App&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Tech Stack&lt;/strong&gt;: C#, SignalR, React Native&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Features&lt;/strong&gt;: Real-time location tracking, route optimization algorithms, and notifications for couriers, shops, and admins.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Impact&lt;/strong&gt;: Streamlined logistics for businesses, improving delivery efficiency and customer satisfaction.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Personal Website Using AstroWind&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Goal&lt;/strong&gt;: A platform to showcase skills, projects, and career highlights with a clean, professional design.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Key Features&lt;/strong&gt;: Responsive design, SEO optimization, and dynamic content integration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Push Notification System&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Tech Stack&lt;/strong&gt;: Lib.Net.Http.WebPush, .NET&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Functionality&lt;/strong&gt;: Sends targeted notifications to users while maintaining strict data security.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Each project reflects Hasan’s dedication to solving real-world problems with clean, efficient code and user-friendly interfaces.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id&#x3D;&quot;a-lifelong-learner&quot;&gt;A Lifelong Learner&lt;/h3&gt;
&lt;p&gt;For Hasan, learning is more than an activity—it’s a philosophy. Whether exploring the possibilities of &lt;strong&gt;Blender&lt;/strong&gt; for 3D modeling or diving into the complexities of &lt;strong&gt;background geolocation tracking&lt;/strong&gt; in &lt;strong&gt;React Native Expo&lt;/strong&gt;, he embraces challenges as opportunities to grow.&lt;/p&gt;
&lt;h4 id&#x3D;&quot;ongoing-learning-initiatives&quot;&gt;&lt;strong&gt;Ongoing Learning Initiatives&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current Focus&lt;/strong&gt;: Exploring &lt;strong&gt;Blender&lt;/strong&gt; to integrate 3D modeling into digital projects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Professional Development&lt;/strong&gt;: Staying updated on the latest trends in &lt;strong&gt;clean architecture&lt;/strong&gt;, &lt;strong&gt;React Native&lt;/strong&gt;, and &lt;strong&gt;AI integration&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Certifications&lt;/strong&gt;: Continuously earning certifications to validate and expand his expertise.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id&#x3D;&quot;building-for-the-future&quot;&gt;Building for the Future&lt;/h3&gt;
&lt;p&gt;Hasan’s personal website isn’t just a portfolio—it’s a window into his vision for the future. It’s a platform designed to inspire collaboration, showcase innovative ideas, and share knowledge with a global audience.&lt;/p&gt;
&lt;h4 id&#x3D;&quot;key-features-of-hasans-website&quot;&gt;&lt;strong&gt;Key Features of Hasan’s Website&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;About Section&lt;/strong&gt;: A comprehensive look at his professional journey and values.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Skills Showcase&lt;/strong&gt;: Categorized technical and non-technical skills with certification highlights.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Projects Portfolio&lt;/strong&gt;: In-depth project descriptions with links to live demos or repositories.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Education &amp;amp; Experience&lt;/strong&gt;: A timeline format for easy navigation of his career and academic milestones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Interactive Contact Form&lt;/strong&gt;: A user-friendly way to connect and collaborate.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id&#x3D;&quot;beyond-the-code&quot;&gt;Beyond the Code&lt;/h3&gt;
&lt;p&gt;Hasan’s story is not just about coding; it’s about connecting with people and ideas. Whether it’s mentoring peers, collaborating with teams, or contributing to open-source projects, he believes in the power of community and knowledge-sharing to drive innovation.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id&#x3D;&quot;ready-to-collaborate&quot;&gt;Ready to Collaborate?&lt;/h3&gt;
&lt;p&gt;Whether you’re looking to collaborate on a project, learn more about Hasan’s work, or just share ideas, don’t hesitate to reach out.&lt;/p&gt;
&lt;p&gt;Visit &lt;a href&#x3D;&quot;https://hasan-aytac.com/&quot;&gt;Hasan Aytaç’s website&lt;/a&gt; for more insights, or drop a message through the contact form to start a conversation. Together, let’s build something amazing!&lt;/p&gt;
&lt;!--kg-card-end: html--&gt;
</content:encoded><category>about-me</category><category>software-development</category><category>clean-architecture</category><category>projects</category><category>continuous-learning</category></item>
<item><title>C# in 2025: What’s New and What’s Next</title><link>https://hasan-aytac.com/csharp-news-2025/</link><guid isPermaLink="false">6acd5e1936affa0001e10259</guid><pubDate>Tue, 28 Jan 2025 00:00:00 +0000</pubDate><description>From language updates to new tooling, the C# ecosystem is evolving fast. Dive into the latest changes and what to expect next as we explore the future of C# development.</description><content:encoded>
&lt;!--kg-card-begin: html--&gt;
&lt;h2 id&#x3D;&quot;c-in-2025-whats-new-and-whats-next&quot;&gt;C# in 2025: What’s New and What’s Next&lt;/h2&gt;
&lt;p&gt;As one of the most versatile and powerful programming languages in the Microsoft ecosystem, C# continues to evolve, embracing modern development needs and trends. Let’s take a closer look at what’s new in C# and what exciting updates are on the horizon.&lt;/p&gt;
&lt;h3 id&#x3D;&quot;language-enhancements&quot;&gt;&lt;strong&gt;Language Enhancements&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;With the recent release of C# 13, developers are welcomed with a slew of new features designed to enhance productivity and code readability:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pattern Matching Enhancements&lt;/strong&gt;: The new ‘match’ expressions now support more complex patterns, making conditional logic cleaner and more powerful.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Required Members&lt;/strong&gt;: A game-changer for immutability and object initialization, ensuring required properties are set during construction.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Interpolated String Handlers&lt;/strong&gt;: Performance improvements when working with strings, especially in logging and formatting-heavy applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id&#x3D;&quot;tooling-and-framework-updates&quot;&gt;&lt;strong&gt;Tooling and Framework Updates&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;The C# ecosystem isn’t just about the language itself; the tools we use daily are getting smarter and faster:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Visual Studio 2025&lt;/strong&gt;: With AI-assisted code completion, integrated testing enhancements, and real-time collaboration tools, coding in C# has never been smoother.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;.NET 9.0&lt;/strong&gt;: Bringing performance boosts, especially in cloud-native applications and microservices, alongside new libraries for machine learning integration.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MAUI Improvements&lt;/strong&gt;: Cross-platform development with .NET MAUI is now more intuitive, with hot reload features and enhanced support for iOS and Android.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id&#x3D;&quot;focus-on-cloud-and-ai&quot;&gt;&lt;strong&gt;Focus on Cloud and AI&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;As cloud computing and AI continue to dominate the tech landscape, C# is aligning itself to be a leader in these areas:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Azure Integration&lt;/strong&gt;: Deep integration with Azure, including new SDKs and libraries that simplify working with Azure Functions, Cosmos DB, and Cognitive Services directly from C# applications.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ML.NET Enhancements&lt;/strong&gt;: Building and deploying machine learning models in C# is more seamless, with better support for custom models and integration with popular data science tools.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id&#x3D;&quot;whats-next&quot;&gt;&lt;strong&gt;What’s Next?&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;The roadmap for C# is full of promise, focusing on enhancing developer experiences and broadening the language’s versatility:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Better Asynchronous Programming Models&lt;/strong&gt;: Continued improvements to async/await patterns, making it easier to write concurrent code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Native Interop Enhancements&lt;/strong&gt;: More seamless interop with native libraries, broadening the scope of what you can achieve with C# in system-level programming.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Developer Community and Open Source&lt;/strong&gt;: Microsoft’s continued investment in open-source initiatives means more community-driven features and faster iterations on the language’s core.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id&#x3D;&quot;why-it-matters&quot;&gt;Why It Matters&lt;/h3&gt;
&lt;p&gt;Staying up to date with the latest in C# is not just about keeping your skills sharp—it’s about leveraging the best tools and practices to build performant, scalable, and maintainable applications. As C# evolves, so do the possibilities for innovation in your projects.&lt;/p&gt;
&lt;p&gt;Whether you’re a seasoned developer or just diving into the world of C#, there’s never been a more exciting time to code. Stay curious, keep experimenting, and be ready to embrace the new features and possibilities that C# 2025 brings!&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;What are you most excited about in the future of C#? Let’s discuss! Drop your thoughts in the comments or connect with me through my &lt;a href&#x3D;&quot;https://hasan-aytac.com/&quot;&gt;website&lt;/a&gt;. Let’s keep pushing the boundaries of what we can build together!&lt;/strong&gt;&lt;/p&gt;
&lt;!--kg-card-end: html--&gt;
</content:encoded><category>csharp</category><category>.net</category><category>software-development</category><category>programming</category><category>updates</category></item>
<item><title>What&#x27;s New in C#: Exploring the Latest Features and Upcoming Changes in 2025</title><link>https://hasan-aytac.com/csharp-2025-updates/</link><guid isPermaLink="false">6acd5e1936affa0001e10258</guid><pubDate>Tue, 28 Jan 2025 00:00:00 +0000</pubDate><description>Stay ahead in the world of C# with the latest updates, new features, and upcoming changes set to revolutionize your development workflow in 2025.</description><content:encoded>
&lt;!--kg-card-begin: html--&gt;
&lt;h2 id&#x3D;&quot;the-evolution-of-c-whats-new-in-2025&quot;&gt;The Evolution of C#: What’s New in 2025?&lt;/h2&gt;
&lt;p&gt;As we step into 2025, the C# ecosystem continues to evolve, bringing new features and improvements designed to enhance productivity, performance, and developer experience. In this post, we’ll explore the latest updates in C# and .NET, along with upcoming changes that every developer should be aware of.&lt;/p&gt;
&lt;h3 id&#x3D;&quot;c-12-enhancing-productivity-with-new-language-features&quot;&gt;&lt;strong&gt;C# 12: Enhancing Productivity with New Language Features&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;The release of &lt;strong&gt;C# 12&lt;/strong&gt; introduces several language enhancements aimed at making code more concise and expressive:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required Members Enhancement&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure essential properties are initialized, simplifying the creation of immutable objects.&lt;/li&gt;
&lt;li&gt;Example:
&lt;pre style&#x3D;&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;public&lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt; class&lt;/span&gt;&lt;span style&#x3D;&quot;color:#B392F0&quot;&gt; User&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;    public&lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt; required&lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt; string&lt;/span&gt;&lt;span style&#x3D;&quot;color:#B392F0&quot;&gt; Name&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt; { &lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;get&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;; &lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;init&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;    public&lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt; int&lt;/span&gt;&lt;span style&#x3D;&quot;color:#B392F0&quot;&gt; Age&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt; { &lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;get&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;; &lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;init&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Primary Constructors for Structs&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simplify struct initialization with primary constructors.
&lt;pre style&#x3D;&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;public&lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt; struct&lt;/span&gt;&lt;span style&#x3D;&quot;color:#B392F0&quot;&gt; Point&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;int&lt;/span&gt;&lt;span style&#x3D;&quot;color:#B392F0&quot;&gt; X&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;, &lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;int&lt;/span&gt;&lt;span style&#x3D;&quot;color:#B392F0&quot;&gt; Y&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt;var&lt;/span&gt;&lt;span style&#x3D;&quot;color:#B392F0&quot;&gt; point&lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt; &#x3D;&lt;/span&gt;&lt;span style&#x3D;&quot;color:#F97583&quot;&gt; new&lt;/span&gt;&lt;span style&#x3D;&quot;color:#B392F0&quot;&gt; Point&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style&#x3D;&quot;color:#79B8FF&quot;&gt;5&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;, &lt;/span&gt;&lt;span style&#x3D;&quot;color:#79B8FF&quot;&gt;10&lt;/span&gt;&lt;span style&#x3D;&quot;color:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;File-Scoped Types&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Reduce boilerplate by defining types directly in files without namespaces for smaller projects.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id&#x3D;&quot;net-8-performance-and-cross-platform-improvements&quot;&gt;&lt;strong&gt;.NET 8: Performance and Cross-Platform Improvements&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;The upcoming &lt;strong&gt;.NET 8&lt;/strong&gt; release focuses on performance enhancements and cross-platform capabilities:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Native AOT Compilation&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ahead-of-Time (AOT) compilation for faster startup times and reduced memory usage, ideal for cloud-native applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Improved HTTP/3 Support&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Enhanced support for HTTP/3, offering reduced latency and improved performance for web applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Simplified MAUI Development&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Improved tooling and performance for &lt;strong&gt;.NET MAUI&lt;/strong&gt; to build native applications for Android, iOS, macOS, and Windows with a single codebase.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id&#x3D;&quot;blazor-expanding-capabilities-with-hybrid-apps&quot;&gt;&lt;strong&gt;Blazor: Expanding Capabilities with Hybrid Apps&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Blazor continues to grow in popularity, and &lt;strong&gt;.NET 8&lt;/strong&gt; introduces hybrid app capabilities, allowing developers to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Combine web and native features in desktop and mobile applications.&lt;/li&gt;
&lt;li&gt;Use Blazor components in &lt;strong&gt;.NET MAUI&lt;/strong&gt; projects for enhanced user experiences.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id&#x3D;&quot;ai-and-c-leveraging-machine-learning-with-mlnet&quot;&gt;&lt;strong&gt;AI and C#: Leveraging Machine Learning with ML.NET&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;With the rise of AI, &lt;strong&gt;ML.NET&lt;/strong&gt; remains a key tool for C# developers to integrate machine learning into applications:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simplified model training with AutoML.&lt;/li&gt;
&lt;li&gt;Enhanced support for &lt;strong&gt;ONNX&lt;/strong&gt; and &lt;strong&gt;TensorFlow&lt;/strong&gt; models.&lt;/li&gt;
&lt;li&gt;New tools for data visualization and model interpretability.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id&#x3D;&quot;upcoming-changes-to-watch-out-for&quot;&gt;&lt;strong&gt;Upcoming Changes to Watch Out For&lt;/strong&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unified Project System&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simplify multi-targeting with a unified project system for libraries supporting multiple .NET versions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Source Generators Expansion&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Expanded capabilities for &lt;strong&gt;Source Generators&lt;/strong&gt;, enabling compile-time metaprogramming to reduce runtime overhead.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Community-Driven Innovations&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Active engagement from the C# community continues to shape the language with proposals and discussions on GitHub and forums.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2 id&#x3D;&quot;preparing-for-the-future&quot;&gt;Preparing for the Future&lt;/h2&gt;
&lt;p&gt;To stay competitive, developers should:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Regularly update their development environments to leverage the latest features.&lt;/li&gt;
&lt;li&gt;Engage with the C# community to share insights and learn from peers.&lt;/li&gt;
&lt;li&gt;Experiment with new features in personal projects to understand their potential and limitations.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id&#x3D;&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;The C# ecosystem in 2025 is poised for exciting advancements, blending productivity enhancements with powerful performance improvements. Whether you’re a seasoned developer or just starting, these updates provide new opportunities to build robust, efficient, and innovative applications.&lt;/p&gt;
&lt;p&gt;Stay tuned for more insights and tutorials on leveraging these features in your projects. Explore &lt;a href&#x3D;&quot;https://hasan-aytac.com/&quot;&gt;Hasan Aytaç’s website&lt;/a&gt; for more articles and resources!&lt;/p&gt;
&lt;!--kg-card-end: html--&gt;
</content:encoded><category>csharp</category><category>dotnet</category><category>programming</category><category>software-development</category><category>updates</category></item>

</channel></rss>
