REST Tip β Use HATEOAS to guide the client
HATEOAS = Hypermedia as the Engine of Application State
π¦ Instead of sending just data, include actions
π§ Why?
β’ Makes APIs discoverable
β’ Reduces hard-coded logic on the client
β’ Enables better versioning and evolution
09.04.2025 10:21 β π 2 π 0 π¬ 0 π 0
Each class type serves a purpose.
Use them wisely to keep your codebase clean, maintainable, and SOLID.
#CSharp #DevCommunity #CleanCode
08.04.2025 19:14 β π 1 π 0 π¬ 0 π 0
6. Nested Classes
Class inside another class.
Can be used for tight coupling (e.g., helper classes for outer class).
08.04.2025 19:14 β π 0 π 0 π¬ 1 π 0
5. Partial Classes
Split one class across multiple files.
Great for large codebases or designer-generated code.
08.04.2025 19:14 β π 0 π 0 π¬ 1 π 0
4. Sealed Classes
Canβt be inherited.
Used when you want to restrict extension.
08.04.2025 19:14 β π 0 π 0 π¬ 1 π 0
3. Static Classes
Only contains static members. Canβt be instantiated or inherited.
Perfect for utility/helper methods.
08.04.2025 19:14 β π 0 π 0 π¬ 1 π 0
2. Abstract Classes
Use abstract when the class is meant to be inherited, not instantiated.
It can have both abstract (unimplemented) and concrete (implemented) methods.
08.04.2025 19:14 β π 0 π 0 π¬ 1 π 0
1. Regular Classes
The most common type: public class MyClass { }
Supports inheritance, encapsulation, constructors, methods, fields.
Can be instantiated with new.
08.04.2025 19:14 β π 0 π 0 π¬ 1 π 0
Letβs talk about C# class types β a solid foundation for OOP in .NET.
Youβll find more than just βclassβ in C#. Letβs dive into the types you can define and use.
08.04.2025 19:14 β π 3 π 1 π¬ 2 π 0
HTTP Tip
Idempotent methods can be safely retried without causing side effects.
πΉ GET, PUT, DELETE, HEAD, OPTIONS β Idempotent
πΉ POST β NOT idempotent
π§ Why?
Using the correct method:
βͺοΈ Makes APIs predictable
βͺοΈ Enables retries in network failures
βͺοΈ Helps with caching, monitoring, and debugging
08.04.2025 17:09 β π 1 π 0 π¬ 0 π 0
π§ Why?
β’ Scalar functions run row by row = performance bottleneck
β’ Use inline expressions, computed columns, or TVFs (table-valued functions) for better scalability
08.04.2025 13:04 β π 1 π 0 π¬ 0 π 0
SQL Tip β Avoid Scalar Functions in SELECT for Performance
π« Bad (Scalar function kills performance on large data)
β
Good (Inline logic or apply in WHERE/CTE for better performance)
Example:
08.04.2025 13:04 β π 1 π 0 π¬ 1 π 0
.NET DI Lifetime Tips:
πΉ Singleton - one of instance for entire app
πΉ Scoped - one instance per request
πΉ Transient - new instance every time
π¨ Be careful:
- Dont inject Scoped/Transient into Singleton (causes bugs/memory leaks)
- Use Singleton only for stateless or thread-safe services.
08.04.2025 12:13 β π 0 π 0 π¬ 0 π 0
LINQ Tip:
Use ToList() after filtering, not before
Why?
πΉ First version loads everything into memory before filtering
πΉ Second version filters at source, better for DB or large collections
πΉ Especially important when using EF Core or APIs with IQueryable
08.04.2025 10:03 β π 1 π 0 π¬ 0 π 0
πΉ Performance: Asynchronous iteration prevents thread blocking, keeping your app responsive.
πΉ Clean Code: No need for callbacks or complex state management like with traditional async operations.
08.04.2025 09:26 β π 0 π 0 π¬ 0 π 0
πΉ await foreach: Asynchronously iterates over the items one by one, allowing for non-blocking execution while the data is being fetched.
Benefits:
πΉMemory Efficiency: Only one item is in memory at a time, so itβs ideal for processing large datasets or streams.
08.04.2025 09:26 β π 0 π 0 π¬ 1 π 0
Explanation:
IAsyncEnumerable<T>: Enables you to stream data asynchronously without blocking threads.
πΉ Use yield return to return items one at a time.
πΉ Data is fetched lazily, so you only process what you need.
08.04.2025 09:26 β π 0 π 0 π¬ 1 π 0
Efficient Async Data Streaming with IAsyncEnumerable<T>
Scenario:
You need to process a large dataset (e.g., database records, file lines, etc.), but you donβt want to load everything into memory at once. Using IAsyncEnumerable<T> lets you stream data asynchronously with minimal memory usage.
08.04.2025 09:26 β π 0 π 0 π¬ 1 π 0
πΉ What is Queue<T>?
Queue<T> is a First-In-First-Out (FIFO) collection in C#.
It means the first item you add is the first one to be removed.
When to use?
- Task scheduling
- Print jobs
- Message handling
- Breadth-first search (BFS) in graphs
Example:
07.04.2025 19:51 β π 1 π 0 π¬ 0 π 0
SQL Tip:
Always monitor and maintain your indexes.
Unused or duplicate indexes = slower writes and wasted space.
Why?
- Clean indexes = faster inserts/updates
- Less I/O, better performance
π Use this to find unused indexes in SQL Server
07.04.2025 19:16 β π 1 π 0 π¬ 0 π 0
Csharp Tip:
Use Span<T> for high-performance, allocation-free array slicing. Avoid ToList() when you donβt need it!
Why?
πΉ Zero allocations
πΉ Lightning-fast memory access
πΉ Perfect for performance-critical code
#csharp #dotnet
07.04.2025 15:37 β π 4 π 0 π¬ 0 π 0
LINQ Trip:
Use GroupJoin for efficient one-to-many relationships instead of nested loops.
Why?
πΉ Cleaner than SelectMany + Where
πΉ Ideal for creating master-detail structures in memory
07.04.2025 11:41 β π 0 π 0 π¬ 0 π 0
SQL Tip:
Use CROSS APPLY for row-wise calculations or to invoke table-valued functions per row.
Why?
πΉPowerful for row-by-row subqueries
πΉCleaner & faster than correlated subqueries in many cases
07.04.2025 08:18 β π 0 π 0 π¬ 0 π 0
Csharp Tip:
Use async Task for methods so exceptions can be awaited and handled properly.
Pro tip: Use async void only for UI event handlers.
06.04.2025 22:34 β π 0 π 0 π¬ 0 π 0
Pass by Value vs Pass by Reference
πΉ Pass by Value: A copy of the value is passed to the function. Changes inside the function donβt affect the original variable.
πΉ Pass by Reference: The memory address (reference) is passed. Changes inside the function do affect the original variable.
06.04.2025 20:23 β π 1 π 0 π¬ 0 π 0
SQL Tip:
Use EXISTS instead of COUNT(*) > 0 for better performance when checking if rows exist.
β
EXISTS stops at the first match.
β COUNT(*) scans the whole table.
Faster checks = faster queries β‘
06.04.2025 12:48 β π 4 π 1 π¬ 0 π 0
How does it work?
Instead of sending 1 SQL query per entity (slow), BulkUpdate:
β
Builds a temporary SQL table
β
Pushes all data into it in one batch
β
Runs a single efficient UPDATE JOIN on the real table
β
Drops the temp table after update
Result: Thousands of updates in milliseconds β‘
06.04.2025 12:37 β π 0 π 0 π¬ 0 π 0
EF Core Tip β Bulk Update:
Need to update thousands of rows? Avoid looping with .SaveChanges() in EF Core β it's slow.
Use a bulk update library like EFCore.BulkExtensions for massive performance gains.
Bonus: Works for Insert, Delete, Merge too.
06.04.2025 12:33 β π 0 π 0 π¬ 1 π 0
Csharp Tip:
Extract magic values into constants to improve readability and maintainability.
Cleaner code = easier maintenance!
06.04.2025 10:04 β π 1 π 0 π¬ 0 π 0
C# Trick:
Use Dictionary for fast lookups instead of looping!
Instead of searching a list repeatedly, store key-value pairs in a dictionary for O(1) access.
05.04.2025 22:44 β π 0 π 0 π¬ 0 π 0
Videogame Design Student at ESAT
- https://linktr.ee/Phantomarrow
Currently working on: @insidethecrowsnest.bsky.social
Contact me via:
- Mail: phantomarrowgd@gmail.com
Software Engineer π¨βπ» | Microsoft MVP π¨π | Floorball player π₯
| Father of two π¦
https://blog.rufer.be/
#devops #devsecops #appsecurity #webdev #azure #dotnet
Azure MVP, software engineer, software architect, blogger and speaker loving all things serverless C# and Azure. Certified Azure Solutions Architect.
software professional β’ artisan bogan β’ os agnostic β’ webassembly β’ c++ β’ c# β’ x86 β’ python β’ langchain β’ semantic kernel β’ leadership β’ quality β’ bants & yarns
Lead Consultant @Devoteam | #Azure, #AzureLocal, #AzureVirtualDesktop, #Windows365 & #Intune | Blog: https://schmitt-nieto.com
Principal engineer at JetBrains, passionate about .NET, performance, and debugging. Microsoft MVP. Co-author of Pro .NET Memory Management (2nd edition)
Software Engineer, Speaker, Microsoft MVP, Carnatic Music Vocal Student
Father, Husband, Dotnet C# Software Development, Atheist / Humanist, Progressive, Vegetarian, Nerd
What we think about, we bring about.
#WeAreDotnet is a community for people who create and enjoy #dotnet related content. This official account provides you with regular updates on our journey.
wearedotnet.io
#dotnet and #gis developer, creator of GeoBlazor open source library
πΉπ·π¨ππ΅πΈ | Twinfather πΆπ»πΆπ» | Dogfather πΆ | Catfather π± | Husband | Softwareengineer π¨π»βπ»
Follow for your daily dose of #humour #fails #wins #funny
https://hashiiiii.com/
SoftwareEngineer@DeNA / Unity / C# / Japanese
Microsoft MVP - BlazorHelpWebsite.com - BlazorData.net - AIStoryBuilders.com (He/Him) - #Blazor - π- #Resistance - #NoICE
lead in software development | semiconductors | podcaster | starting CrossFit | growth mindset | sharing is caring!
Build .NET Apps, share coding experiences, and memes. I work for Azure Tools team @ Microsoft. Check out my portfolio β‘ https://codewithsaar.com π and my GitHub: https://github.com/xiaomi7732
Mobile app developer - Xamarin / MAUI - Swift & SwiftUI
Software Developer | AWS / Cloud | JVM / Node.js | IaC | Serverless | Kubernetes
π§πΌβπ»Works @ The LEGO Group | Billund π©π°
Www: https://moelholm.com
GitHub: http://github.com/moelholm
Strava: https://www.strava.com/athletes/nmlholm
World-class #ASPNETCore #Blazor http://Coding-Machine.NET converting #c0ffee β to #c0de π¨βπ» as #10Xer // all opinions are your own π #PunksNotDead π€