Code Whisper
banner
codewhisper.bsky.social
Code Whisper
@codewhisper.bsky.social
👾 Anonymous engineer, sharing thoughts on code, tech & systems.
🚫 No face, just logic.

x.com/codewhisperdev
Each class type serves a purpose.
Use them wisely to keep your codebase clean, maintainable, and SOLID.

#CSharp #DevCommunity #CleanCode
April 8, 2025 at 7:14 PM
6. Nested Classes

Class inside another class.
Can be used for tight coupling (e.g., helper classes for outer class).
April 8, 2025 at 7:14 PM
5. Partial Classes

Split one class across multiple files.
Great for large codebases or designer-generated code.
April 8, 2025 at 7:14 PM
4. Sealed Classes

Can’t be inherited.
Used when you want to restrict extension.
April 8, 2025 at 7:14 PM
3. Static Classes

Only contains static members. Can’t be instantiated or inherited.
Perfect for utility/helper methods.
April 8, 2025 at 7:14 PM
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.
April 8, 2025 at 7:14 PM
1. Regular Classes

The most common type: public class MyClass { }
Supports inheritance, encapsulation, constructors, methods, fields.
Can be instantiated with new.
April 8, 2025 at 7:14 PM
🧠 Why?
• Scalar functions run row by row = performance bottleneck
• Use inline expressions, computed columns, or TVFs (table-valued functions) for better scalability
April 8, 2025 at 1:05 PM
🔹 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.
April 8, 2025 at 9:26 AM
🔹 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.
April 8, 2025 at 9:26 AM
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.
April 8, 2025 at 9:26 AM