𝗖# 𝗲𝘅𝘁𝗲𝗻𝘀𝗶𝗼𝗻: 𝗘𝗶𝘁𝗵𝗲𝗿 ⚖️ Either in C# is a small idea with a big payoff: a method returns one of two outcomes, usually success or error, without pushing expected failures into exceptions. 🧩 That makes control flow clearer, contracts more honest, and error handling impossible to ignore. 🛠️ Either fits especially well in validation, domain logic, and application services where failure is part of normal behavior. 💡 Cleaner APIs, fewer surprises, and more predictable code — that is why many teams adopt it. #dotnet #csharp #functionalprogramming #either #softwareengineering #backend #cleancode #aspnetcore #programming #developers
Dmitrii Shorokhov’s Post
More Relevant Posts
-
𝗠𝗼𝘀𝘁 𝗱𝗲𝘃𝗲𝗹𝗼𝗽𝗲𝗿𝘀 𝘂𝘀𝗲 𝗖#... But very few actually understand 𝘄𝗵𝗮𝘁 𝗵𝗮𝗽𝗽𝗲𝗻𝘀 𝗮𝗳𝘁𝗲𝗿 𝗵𝗶𝘁𝘁𝗶𝗻𝗴 𝗥𝗨𝗡. This visual breaks it down step by step: • How C# code is compiled into IL • How the .NET runtime (CLR) manages execution • How JIT converts it into machine code If you’ve ever been 𝗰𝗼𝗻𝗳𝘂𝘀𝗲𝗱 about: – how your code actually runs – what CLR really does – or why performance behaves the way it does This will make things much clearer. Understanding this isn’t just theory — it helps you write better, faster, and more reliable code. 𝗪𝗵𝗮𝘁 𝗽𝗮𝗿𝘁 𝗼𝗳 𝗖# 𝗼𝗿 .𝗡𝗘𝗧 𝗱𝗼 𝘆𝗼𝘂 𝗳𝗶𝗻𝗱 𝗵𝗮𝗿𝗱𝗲𝘀𝘁 𝘁𝗼 𝘂𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱? #csharp #dotnet #programming #softwaredevelopment #backenddevelopment #developers #aspnetcore #fullstackdeveloper
To view or add a comment, sign in
-
-
Top 3 .NET Mistakes Developers Make 1. Using synchronous code slows down performance. - Use async methods for better speed. #dotnet #webdevelopment #backenddeveloper #apiintegration #softwaredevelopment #programming #tech #scalability #performance #developers
To view or add a comment, sign in
-
-
🚀 Why use Task.WhenAll in .NET? Running async operations sequentially can slow down your application more than you think. With Task.WhenAll, you execute tasks in parallel — improving performance and keeping your code clean. ✔ Faster execution ✔ Better scalability ✔ Cleaner, more maintainable code ✔ Centralized error handling Small change — big impact on performance. #dotnet #csharp #async #programming #softwaredevelopment
To view or add a comment, sign in
-
-
🚀 C# 1.0 – The Foundation of Modern .NET Development Back in 2002, C# 1.0 marked the beginning of a powerful, type-safe, and object-oriented programming language that continues to evolve today. Understanding its fundamentals gives strong clarity on how modern C# features are built. 🔹 Key Features of C# 1.0: 👉 Object-Oriented Programming (OOP) Introduced core OOP principles like classes, inheritance, encapsulation, and polymorphism — forming the backbone of scalable applications. 👉 Delegates Type-safe function pointers that enabled callback mechanisms and laid the groundwork for events and asynchronous programming. 👉 Access Modifiers Control visibility and encapsulation using public, private, and protected — essential for secure and maintainable code. 👉 Arrays Strongly-typed, fixed-size collections to manage data efficiently. 👉 Events Built on delegates, enabling event-driven programming — a key concept in UI and reactive systems. 👉 Exception Handling Robust error management using try-catch-finally, improving application stability. 💡 Why it matters? C# 1.0 wasn’t just a starting point — it defined the design philosophy of simplicity, safety, and scalability that still drives .NET today. 📌 Master the basics. Everything advanced builds on this. #CSharp #DotNet #Programming #SoftwareDevelopment #Coding #TechLearning #Developers #OOP #BackendDevelopment #CareerGrowth
To view or add a comment, sign in
-
-
Managed vs Unmanaged Code in .NET — What’s the Real Difference? 🤔 Many developers hear these terms… but don’t fully understand them. Let’s break it down simply 👇 🔹 Managed Code • Runs under the control of CLR (Common Language Runtime) • Automatic memory management (Garbage Collection) • Safer and easier to work with • Example: C#, VB.NET 🔹 Unmanaged Code • Runs directly on the OS (no CLR) • Manual memory management • More control, but higher risk (memory leaks, crashes) • Example: C, C++ ⚠️ Why this matters? Understanding this helps you: ✔ Avoid memory-related issues ✔ Write safer applications ✔ Know when low-level control is needed 💡 In simple terms: Managed = Safe & Easy Unmanaged = Powerful but Risky Small concepts like this build strong foundations 🚀 #dotnet #csharp #softwareengineering #backend #programming #developers #tech
To view or add a comment, sign in
-
-
📌 📌📌 💡 Async vs Sync in C# — Why it matters? In modern applications, performance and responsiveness are everything. Understanding the difference between synchronous and asynchronous programming can completely change how your application behaves. 🔹 Synchronous (Sync) Executes tasks one after another → blocks the thread ⏳ 👉 Result: Slower performance & unresponsive UI 🔹 Asynchronous (Async) Executes tasks without blocking → continues other work ⚡ 👉 Result: Better performance & smooth user experience 🚀 Key Takeaway: Using async and await allows your application to handle long-running operations like API calls, database queries, and file handling efficiently. ⚠ Common Pitfall: Avoid .Result and .Wait() → they can cause deadlocks and reduce performance. 🎯 Pro Tip: 👉 “Async all the way” — don’t mix sync & async code. #CSharp #DotNet #AsyncAwait #Programming #SoftwareDevelopment #BackendDeveloper #CodingTips #Developers #TechLearning
To view or add a comment, sign in
-
-
What’s new in .𝐍𝐄𝐓 11? Here’s everything you need to know about the next version of .𝐍𝐄𝐓! 🚀 .𝐍𝐄𝐓 11 is in preview with the final release expected in 𝐍𝐨𝐯𝐞𝐦𝐛𝐞𝐫 2026. Here’s a breakdown of all the major performance improvements, API updates, and features that will make your .NET applications even faster and easier to develop. 👇 #DotNet #CSharp #SoftwareDevelopment #TechNews #Microservices #CloudDevelopment #DevOps #OpenSource #Performance #Programming #SoftwareEngineering
To view or add a comment, sign in
-
One of the cleanest “why didn’t I always do this?” upgrades in "modern" C# is the 𝐧𝐮𝐥𝐥-𝐜𝐨𝐧𝐝𝐢𝐭𝐢𝐨𝐧𝐚𝐥 𝐨𝐩𝐞𝐫𝐚𝐭𝐨𝐫: 1) Cleaner 2) Safe 3) Easier to scan 4) Less “if-statements” It’s not a fancy framework… it’s just better 𝐝𝐚𝐢𝐥𝐲 𝐜𝐨𝐝𝐢𝐧𝐠. 𝐒𝐨𝐦𝐞𝐭𝐢𝐦𝐞𝐬 "𝐦𝐨𝐝𝐞𝐫𝐧" 𝐂# 𝐢𝐬𝐧’𝐭 𝐚𝐛𝐨𝐮𝐭 𝐟𝐚𝐧𝐜𝐲 𝐟𝐞𝐚𝐭𝐮𝐫𝐞𝐬… 𝐢𝐭’𝐬 𝐚𝐛𝐨𝐮𝐭 𝐦𝐚𝐤𝐢𝐧𝐠 𝐞𝐯𝐞𝐫𝐲𝐝𝐚𝐲 𝐜𝐨𝐝𝐞 𝐬𝐢𝐦𝐩𝐥𝐞𝐫. #csharp #dotnet #programming #softwareengineering #softwaredevelopment
To view or add a comment, sign in
-
-
Most C# developers slow down their own code… without realizing it. And the reason is just one line 👇 👉 .ToList() Looks harmless, right? But here’s what actually happens: When you write: var users = db.Users.Where(x => x.IsActive).ToList(); 💥 You force the entire data to load into memory immediately Even if you only need a few records later. Now compare that with: var users = db.Users.Where(x => x.IsActive); 👉 No execution yet 👉 Data is fetched only when needed This is called deferred execution 🔥 Why this matters: Better performance Less memory usage Faster APIs ⚠️ The mistake: Using .ToList() too early in the pipeline Most developers do this out of habit… not necessity. ✅ Better approach: Keep it as IEnumerable / IQueryable as long as possible Convert to List only when you really need it 💡 Real impact: In large applications, this small change can 👉 reduce load time 👉 improve scalability 👉 save resources Good code is not just about making it work… It’s about making it efficient. #dotnet #csharp #backenddeveloper #softwareengineering #programming #developers #codingtips #performance
To view or add a comment, sign in
-
Most developers know the syntax of const and readonly in C#… But very few understand where they actually break systems in real-world enterprise applications. I’ve seen developers use const for API versions, configuration values, and even feature flags — which later caused unexpected production issues in distributed systems and microservices. That’s when I realized: - const is not just about “fixed values” - readonly is not just about “cannot change” The real difference is: - Compile-time vs Runtime behavior. In enterprise applications, choosing the wrong one can lead to: • Hidden deployment issues • Old values being embedded into assemblies • Unexpected behavior across services • Difficult debugging in production Here’s a visual cheat sheet I created to explain: - When to use const - When to use readonly - Real-world use cases - Common mistakes developers make - Best practices followed in scalable .NET systems One simple keyword choice can impact maintainability, scalability, and deployment safety. What’s the most interesting real-world use case of readonly or const you’ve seen? #dotnet #csharp #softwareengineering #backenddevelopment #cleanarchitecture #microservices #dotnetdeveloper #programming #developers #coding #aspnetcore
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Why this post? What are the downsides of using Either? For failures, isn't some Result type better, more specific than Either?