Jalal Alzebda

Jalal Alzebda

These are the best posts from Jalal Alzebda.

11 viral posts with 15,028 likes, 848 comments, and 933 shares.
11 image posts, 0 carousel posts, 0 video posts, 0 text posts.

๐Ÿ‘‰ Go deeper on Jalal Alzebda's LinkedIn with the ContentIn Chrome extension ๐Ÿ‘ˆ

Best Posts by Jalal Alzebda on LinkedIn

๐Ÿ’ก๐—–# ๐—ง๐—ถ๐—ฝ
โœ” .๐—ก๐—˜๐—ง ๐Ÿด ๐——๐—ฎ๐˜๐—ฎ ๐—”๐—ป๐—ป๐—ผ๐˜๐—ฎ๐˜๐—ถ๐—ผ๐—ป๐˜€

โญ .๐—ก๐—˜๐—ง ๐Ÿด introduces several new ๐—ฑ๐—ฎ๐˜๐—ฎ ๐—ฎ๐—ป๐—ป๐—ผ๐˜๐—ฎ๐˜๐—ถ๐—ผ๐—ป๐˜€ that improve data validation capabilities, making it easier to enforce data integrity and business rules.

โœ… ๐—Ÿ๐—ฒ๐—ป๐—ด๐˜๐—ต ๐—”๐˜๐˜๐—ฟ๐—ถ๐—ฏ๐˜‚๐˜๐—ฒ: Ensures string or collection lengths are within a specified range.

โœ… ๐—ฅ๐—ฎ๐—ป๐—ด๐—ฒ ๐—”๐˜๐˜๐—ฟ๐—ถ๐—ฏ๐˜‚๐˜๐—ฒ ๐˜„๐—ถ๐˜๐—ต ๐— ๐—ถ๐—ป๐—ถ๐—บ๐˜‚๐—บ/๐— ๐—ฎ๐˜…๐—ถ๐—บ๐˜‚๐—บ ๐—˜๐˜…๐—ฐ๐—น๐˜‚๐˜€๐—ถ๐˜ƒ๐—ถ๐˜๐˜†: Validates numeric ranges with optional exclusivity.

โœ… ๐—•๐—ฎ๐˜€๐—ฒ๐Ÿฒ๐Ÿฐ๐—ฆ๐˜๐—ฟ๐—ถ๐—ป๐—ด ๐—”๐˜๐˜๐—ฟ๐—ถ๐—ฏ๐˜‚๐˜๐—ฒ: Validates that a string is a valid Base64 encoded representation.

โœ… ๐—”๐—น๐—น๐—ผ๐˜„๐—ฒ๐—ฑ ๐—ฉ๐—ฎ๐—น๐˜‚๐—ฒ๐˜€ ๐—”๐˜๐˜๐—ฟ๐—ถ๐—ฏ๐˜‚๐˜๐—ฒ: Restricts a property to a set of predefined values.

โœ… ๐——๐—ฒ๐—ป๐—ถ๐—ฒ๐—ฑ ๐—ฉ๐—ฎ๐—น๐˜‚๐—ฒ๐˜€ ๐—”๐˜๐˜๐—ฟ๐—ถ๐—ฏ๐˜‚๐˜๐—ฒ: Ensures a property does not contain specific values.

๐Ÿ”ฅ These new annotations enhance the reliability, maintainability, and security of .NET applications by providing a straightforward yet powerful way to enforce data integrity and validation rules.

๐Ÿค” Did you use Data Annotations ?


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ“–

#csharp #dotnet #programming #aspnetcore
Post image by Jalal Alzebda
๐Ÿ’Ž ๐—–๐—น๐—ฒ๐—ฎ๐—ป ๐—–๐—ผ๐—ฑ๐—ฒ
โœ” ๐—จ๐˜€๐—ฒ ๐—ฟ๐—ฒ๐—ฐ๐—ผ๐—ฟ๐—ฑ๐˜€ ๐—ณ๐—ผ๐—ฟ ๐——๐—ง๐—ข๐˜€

โœ… ๐—ฅ๐—ฒ๐—ฐ๐—ผ๐—ฟ๐—ฑ๐˜€ are a feature introduced in ๐—–# ๐Ÿต.๐Ÿฌ that allows you to create simple, immutable data types. They are particularly useful for representing ๐——๐—ง๐—ข๐˜€ (Data Transfer Objects) because they provide a concise syntax for defining classes that are primarily used to transfer data between layers of an application, such as between the business logic layer and the presentation layer.

โœ… ๐—ฅ๐—ฒ๐—ฐ๐—ผ๐—ฟ๐—ฑ๐˜€ are best suited for simple data structures, and they are not meant to replace classes for all scenarios. For more complex types with behavior, you may still want to use regular classes or other features provided by C#.

๐Ÿ”ฅ ๐—ฅ๐—ฒ๐—ฐ๐—ผ๐—ฟ๐—ฑ๐˜€ are an excellent choice for creating ๐——๐—ง๐—ข๐˜€ due to their simplicity, immutability, and concise syntax, which helps in writing clean and maintainable code.


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ“–

#csharp #dotnet #programming #cleancode #aspnetcore #programmingtips
Post image by Jalal Alzebda
๐Ÿ’ก๐—–# ๐—ง๐—ถ๐—ฝ
โœ”๐—จ๐˜€๐—ฒ ๐—ป๐—ฎ๐—บ๐—ฒ๐—ผ๐—ณ() ๐˜๐—ผ ๐—ฐ๐—ผ๐—ป๐˜ƒ๐—ฒ๐—ฟ๐˜ ๐—ฎ๐—ป ๐—ฒ๐—ป๐˜‚๐—บ ๐˜๐—ผ ๐—ฎ ๐˜€๐˜๐—ฟ๐—ถ๐—ป๐—ด

โœ…ย The ๐—ง๐—ผ๐—ฆ๐˜๐—ฟ๐—ถ๐—ป๐—ด method, inherited from the System.Object class, is used to convert a value into its string representation. It can be overridden in derived classes to provide a meaningful string representation of the object's current state.

โœ…ย The ๐—ป๐—ฎ๐—บ๐—ฒ๐—ผ๐—ณ keyword, introduced in C# 6.0, is used to get the name of a variable, type, or member as a string at compile-time. It's useful to avoid magic strings in your code and to keep your code refactor-friendly.

๐Ÿš€ย ๐—ป๐—ฎ๐—บ๐—ฒ๐—ผ๐—ณ() is the preferred way to convert an enum to a string. This is because nameof() is evaluated at compile time and will inject a string literal that will never change, while ToString() is evaluated at runtime. This means that nameof() is more efficient and can help to improve the performance of your code.

๐Ÿ’กย Using nameof() with enums can lead to mismatched enum member names if the enum changes without recompiling referencing projects, as nameof() provides names at compile-time.


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ“–

#csharpย #dotnetย #programmingย #cleancodeย #aspnetcoreย #performancetips
Post image by Jalal Alzebda
๐Ÿ’Ž ๐—–๐—น๐—ฒ๐—ฎ๐—ป ๐—–๐—ผ๐—ฑ๐—ฒ
โœ” ๐—”๐˜ƒ๐—ผ๐—ถ๐—ฑ ๐—ง๐—ผ๐—ผ ๐— ๐—ฎ๐—ป๐˜† ๐—”๐—ฟ๐—ด๐˜‚๐—บ๐—ฒ๐—ป๐˜๐˜€ ๐—œ๐—ป ๐—™๐˜‚๐—ป๐—ฐ๐˜๐—ถ๐—ผ๐—ป๐˜€

โœ… It's a good practice to limit the number of function arguments to two. If a function requires more than that, it may be a sign that the function is doing too much and should be refactored.

๐Ÿ’ป We can refactor the function to use a ๐˜€๐˜๐—ฟ๐˜‚๐—ฐ๐˜ or ๐—ฐ๐—น๐—ฎ๐˜€๐˜€ to encapsulate related parameters instead of passing them as individual arguments.

๐Ÿ”ฅ ๐—”๐—ฑ๐˜ƒ๐—ฎ๐—ป๐˜๐—ฎ๐—ด๐—ฒ๐˜€ ๐—ผ๐—ณ ๐—ฎ๐˜ƒ๐—ผ๐—ถ๐—ฑ๐—ถ๐—ป๐—ด ๐˜๐—ผ๐—ผ ๐—บ๐—ฎ๐—ป๐˜† ๐—ฎ๐—ฟ๐—ด๐˜‚๐—บ๐—ฒ๐—ป๐˜๐˜€ ๐—ถ๐—ป ๐—ณ๐˜‚๐—ป๐—ฐ๐˜๐—ถ๐—ผ๐—ป๐˜€:
โ—พ Improved code readability.
โ—พ Easier code maintenance.
โ—พ Simplified testing.
โ—พ Increased code flexibility

๐Ÿ’ก Avoiding too many arguments in functions is an important practice for writing clean and maintainable code. By using objects to encapsulate data, we can simplify function signatures and make our code more readable and easier to test.


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ˜Š

#csharpย #dotnetย #programmingย #cleancodeย #aspnetcoreย #programmingtips
Post image by Jalal Alzebda
๐Ÿ’ก๐—–# ๐—ง๐—ถ๐—ฝ
โœ” ๐—˜๐˜…๐—ฐ๐—ฒ๐—ฝ๐˜๐—ถ๐—ผ๐—ป ๐˜ƒ๐˜€ ๐—ฅ๐—ฒ๐˜€๐˜‚๐—น๐˜ ๐—ฃ๐—ฎ๐˜๐˜๐—ฒ๐—ฟ๐—ป

โœ… ๐—˜๐˜…๐—ฐ๐—ฒ๐—ฝ๐˜๐—ถ๐—ผ๐—ป๐˜€ are special objects that represent an error or an unexpected event that occurs during the execution of a program. When an exception is thrown, it propagates up the call stack until it is caught by an appropriate catch block.

โœ… ๐—ฅ๐—ฒ๐˜€๐˜‚๐—น๐˜ ๐—ฃ๐—ฎ๐˜๐˜๐—ฒ๐—ฟ๐—ป offers an alternative approach. Instead of throwing exceptions, methods return a result object. This object encapsulates either the successful result of the operation or an error message.

๐Ÿ’ก ๐—˜๐˜…๐—ฐ๐—ฒ๐—ฝ๐˜๐—ถ๐—ผ๐—ป๐˜€ are more suitable for handling errors that are unexpected and outside the normal flow of the program.

๐Ÿ’ก ๐—ฅ๐—ฒ๐˜€๐˜‚๐—น๐˜ ๐—ฃ๐—ฎ๐˜๐˜๐—ฒ๐—ฟ๐—ป can be more appropriate for expected errors or when you want to avoid the overhead of exceptions.


๐Ÿค” Did you use the Result Pattern?


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ“–

#csharpย #dotnetย #programmingย #aspnetcore
Post image by Jalal Alzebda
๐Ÿ’ก๐—–# ๐—ง๐—ถ๐—ฝ
โœ” ๐—ฅ๐—ฒ๐—ฝ๐—น๐—ฎ๐—ฐ๐—ฒ ๐—ถ๐—ณ ๐˜€๐˜๐—ฎ๐˜๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐˜„๐—ถ๐˜๐—ต ๐—ก๐˜‚๐—น๐—น ๐—–๐—ผ๐—ป๐—ฑ๐—ถ๐˜๐—ถ๐—ผ๐—ป๐—ฎ๐—น ๐—ข๐—ฝ๐—ฒ๐—ฟ๐—ฎ๐˜๐—ผ๐—ฟ

โœ… The ๐—ป๐˜‚๐—น๐—น ๐—ฐ๐—ผ๐—ป๐—ฑ๐—ถ๐˜๐—ถ๐—ผ๐—ป๐—ฎ๐—น ๐—ผ๐—ฝ๐—ฒ๐—ฟ๐—ฎ๐˜๐—ผ๐—ฟ, also known as the null propagation operator or the safe navigation operator, is a feature introduced in ๐—–# ๐Ÿฒ.๐Ÿฌ that allows you to write cleaner and more concise code when dealing with potentially null reference types.

๐Ÿ’ก The ๐—ป๐˜‚๐—น๐—น ๐—ฐ๐—ผ๐—ป๐—ฑ๐—ถ๐˜๐—ถ๐—ผ๐—ป๐—ฎ๐—น ๐—ผ๐—ฝ๐—ฒ๐—ฟ๐—ฎ๐˜๐—ผ๐—ฟ is represented by a question mark followed by a period (?.) and is used to access members or invoke methods on an object that may be null. If the object is null, the expression returns null instead of throwing a null reference exception.

๐Ÿ”ฅ ๐—”๐—ฑ๐˜ƒ๐—ฎ๐—ป๐˜๐—ฎ๐—ด๐—ฒ๐˜€ ๐—ผ๐—ณ ๐˜‚๐˜€๐—ถ๐—ป๐—ด ๐˜๐—ต๐—ฒ ๐—ป๐˜‚๐—น๐—น ๐—ฐ๐—ผ๐—ป๐—ฑ๐—ถ๐˜๐—ถ๐—ผ๐—ป๐—ฎ๐—น ๐—ผ๐—ฝ๐—ฒ๐—ฟ๐—ฎ๐˜๐—ผ๐—ฟ:
โ—พIt can make your code more concise and readable.
โ—พIt can help to avoid null-reference exceptions.
โ—พIt can be used to chain together multiple member or element accesses, even if some of the members or elements may be null.

๐Ÿค” What is your opinion on the null conditional operator?


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ“–

#csharp #dotnet #programming #aspnetcore #programmingtips
Post image by Jalal Alzebda
๐Ÿ’ก๐—–# ๐—ง๐—ถ๐—ฝ
โœ” ๐—–# ๐Ÿญ๐Ÿฎ ๐—ฃ๐—ฟ๐—ถ๐—บ๐—ฎ๐—ฟ๐˜† ๐—–๐—ผ๐—ป๐˜€๐˜๐—ฟ๐˜‚๐—ฐ๐˜๐—ผ๐—ฟ๐˜€

โœ… ๐—–# ๐Ÿญ๐Ÿฎ introduces ๐—ฝ๐—ฟ๐—ถ๐—บ๐—ฎ๐—ฟ๐˜† ๐—ฐ๐—ผ๐—ป๐˜€๐˜๐—ฟ๐˜‚๐—ฐ๐˜๐—ผ๐—ฟ๐˜€, a concise syntax to declare constructors whose parameters are available anywhere in the body of the type.

๐—ง๐—ต๐—ฒ ๐—บ๐—ผ๐˜€๐˜ ๐—ฐ๐—ผ๐—บ๐—บ๐—ผ๐—ป ๐˜‚๐˜€๐—ฒ๐˜€ ๐—ณ๐—ผ๐—ฟ ๐—ฎ ๐—ฝ๐—ฟ๐—ถ๐—บ๐—ฎ๐—ฟ๐˜† ๐—ฐ๐—ผ๐—ป๐˜€๐˜๐—ฟ๐˜‚๐—ฐ๐˜๐—ผ๐—ฟ ๐—ฝ๐—ฎ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜๐—ฒ๐—ฟ ๐—ฎ๐—ฟ๐—ฒ:
โ—พ As an argument to a base() constructor invocation.
โ—พ To initialize a member field or property.
โ—พ Referencing the constructor parameter in an instance member.

๐Ÿ”ฅ You can use the ๐—ฝ๐—ฟ๐—ถ๐—บ๐—ฎ๐—ฟ๐˜† ๐—ฐ๐—ผ๐—ป๐˜€๐˜๐—ฟ๐˜‚๐—ฐ๐˜๐—ผ๐—ฟ๐˜€ as best suits your design. For classes and structs, primary constructor parameters are parameters to a constructor that must be invoked. You can use them to initialize properties. You can initialize fields. Those properties or fields can be immutable, or mutable. You can use them in methods.

๐Ÿค” Did you use it before? Do you like it?


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ“–

#csharp #dotnet #programming #cleancode #aspnetcore
Post image by Jalal Alzebda
๐Ÿ’ก๐—–# ๐—ง๐—ถ๐—ฝ
โœ” ๐—จ๐˜€๐—ฒ ๐—ฟ๐—ฒ๐—ฐ๐—ผ๐—ฟ๐—ฑ๐˜€ ๐—ณ๐—ผ๐—ฟ ๐——๐—ง๐—ข๐˜€

โœ… ๐—ฅ๐—ฒ๐—ฐ๐—ผ๐—ฟ๐—ฑ๐˜€ are a feature introduced in ๐—–# ๐Ÿต.๐Ÿฌ that allows you to create simple, immutable data types. They are particularly useful for representing ๐——๐—ง๐—ข๐˜€ (Data Transfer Objects) because they provide a concise syntax for defining classes that are primarily used to transfer data between layers of an application, such as between the business logic layer and the presentation layer.

โœ… ๐—ฅ๐—ฒ๐—ฐ๐—ผ๐—ฟ๐—ฑ๐˜€ are best suited for simple data structures, and they are not meant to replace classes for all scenarios. For more complex types with behavior, you may still want to use regular classes or other features provided by C#.

๐Ÿ”ฅ ๐—ฅ๐—ฒ๐—ฐ๐—ผ๐—ฟ๐—ฑ๐˜€ are an excellent choice for creating ๐——๐—ง๐—ข๐˜€ due to their simplicity, immutability, and concise syntax, which helps in writing clean and maintainable code.

๐Ÿค” What is your opinion?


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ“–

#csharpย #dotnetย #programmingย #aspnetcoreย #programmingtips
Post image by Jalal Alzebda
๐Ÿ’ก๐—–# ๐—ง๐—ถ๐—ฝ
โœ” ๐—ฃ๐—ฟ๐—ฒ๐—ณ๐—ฒ๐—ฟ ๐—ง๐—ฎ๐˜€๐—ธ.๐—ช๐—ต๐—ฒ๐—ป๐—”๐—น๐—น ๐—ผ๐˜ƒ๐—ฒ๐—ฟ ๐—บ๐˜‚๐—น๐˜๐—ถ๐—ฝ๐—น๐—ฒ ๐—ฎ๐˜„๐—ฎ๐—ถ๐˜๐˜€

โœ… ๐—ง๐—ฎ๐˜€๐—ธ.๐—ช๐—ต๐—ฒ๐—ป๐—”๐—น๐—น is a method that allows you to await the completion of multiple asynchronous tasks concurrently. It's part of the System.Threading.Tasks namespace and is often used in scenarios where you want to wait for multiple asynchronous operations to complete without blocking the main thread.

๐Ÿš€ Using ๐—ง๐—ฎ๐˜€๐—ธ.๐—ช๐—ต๐—ฒ๐—ป๐—”๐—น๐—น can lead to better performance in scenarios where you have multiple independent asynchronous operations that can be executed concurrently. Instead of awaiting each task one by one, you can use Task.WhenAll to wait for all of them simultaneously, thus potentially reducing the overall waiting time.

๐Ÿ’ก Avoid using ๐—ง๐—ฎ๐˜€๐—ธ.๐—ช๐—ต๐—ฒ๐—ป๐—”๐—น๐—น in scenarios where tasks have complex dependencies, require specialized synchronization, have limited available resources, involve mostly synchronous I/O, need isolation of exceptions, or demand sequential execution. Additionally, exercise caution when using it on UI threads, and evaluate whether the benefits of concurrency outweigh the potential downsides in terms of performance and control.


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ“–

#csharpย #dotnetย #programmingย #cleancodeย #aspnetcoreย #performancetips
Post image by Jalal Alzebda
๐Ÿ’Ž ๐—–๐—น๐—ฒ๐—ฎ๐—ป ๐—–๐—ผ๐—ฑ๐—ฒ
โœ” ๐—ฉ๐—ฒ๐—ฟ๐˜๐—ถ๐—ฐ๐—ฎ๐—น ๐—–๐—ผ๐—ฑ๐—ถ๐—ป๐—ด ๐—ฆ๐˜๐˜†๐—น๐—ฒ

โœ… It is a clean code practice that emphasizes ๐˜„๐—ฟ๐—ถ๐˜๐—ถ๐—ป๐—ด ๐—ฐ๐—ผ๐—ฑ๐—ฒ ๐˜ƒ๐—ฒ๐—ฟ๐˜๐—ถ๐—ฐ๐—ฎ๐—น๐—น๐˜† instead of horizontally. In other words, each method or property invocation, or each attribute or function call, should be on a new line, rather than chaining multiple calls together on a single line. This makes the code taller (more lines) but narrower (fewer characters per line). The goal is to improve readability and maintainability by making the code easier to understand and navigate.

๐Ÿ”ฅ ๐—ฉ๐—ฒ๐—ฟ๐˜๐—ถ๐—ฐ๐—ฎ๐—น ๐—–๐—ผ๐—ฑ๐—ถ๐—ป๐—ด ๐—ฆ๐˜๐˜†๐—น๐—ฒ enhances readability and debugging by avoiding long lines, promotes modular programming through easy identification and refactoring of smaller code units.


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ“–

#csharpย #dotnetย #programmingย #cleancodeย #aspnetcoreย #programmingtips
Post image by Jalal Alzebda
๐Ÿ’ก๐—–# ๐—ง๐—ถ๐—ฝ
โœ” ๐—˜๐˜…๐—ฐ๐—ฒ๐—ฝ๐˜๐—ถ๐—ผ๐—ป ๐˜ƒ๐˜€ ๐—ฅ๐—ฒ๐˜€๐˜‚๐—น๐˜ ๐—ฃ๐—ฎ๐˜๐˜๐—ฒ๐—ฟ๐—ป

โœ… ๐—˜๐˜…๐—ฐ๐—ฒ๐—ฝ๐˜๐—ถ๐—ผ๐—ป๐˜€ are special objects that represent an error or an unexpected event that occurs during the execution of a program. When an exception is thrown, it propagates up the call stack until it is caught by an appropriate catch block.

โœ… ๐—ฅ๐—ฒ๐˜€๐˜‚๐—น๐˜ ๐—ฃ๐—ฎ๐˜๐˜๐—ฒ๐—ฟ๐—ป offers an alternative approach. Instead of throwing exceptions, methods return a result object. This object encapsulates either the successful result of the operation or an error message.

๐Ÿ’ก ๐—˜๐˜…๐—ฐ๐—ฒ๐—ฝ๐˜๐—ถ๐—ผ๐—ป๐˜€ are more suitable for handling errors that are unexpected and outside the normal flow of the program.

๐Ÿ’ก ๐—ฅ๐—ฒ๐˜€๐˜‚๐—น๐˜ ๐—ฃ๐—ฎ๐˜๐˜๐—ฒ๐—ฟ๐—ป can be more appropriate for expected errors or when you want to avoid the overhead of exceptions.


๐Ÿค” Did you use the Result Pattern?


๐—ง๐—ต๐—ฎ๐—ป๐—ธ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐Ÿ“–

#csharpย #dotnetย #programmingย #cleancodeย #aspnetcoreย #performancetips
Post image by Jalal Alzebda

Related Influencers