A code snippet illustrating the usage of tuples in C# to return multiple values

Tuples in C#: Too simple or too complex?

Too simple to be a complex type, too complex to be a simple attribute. That鈥檚 what tuples in C# are. Perfect for returning multiple values from a method. No need to create a class (or even a record). Easy to read. Take a look at the image post and see how to use it. Do you use tuples, or do you prefer DTOs/records? 馃憠 Adapted from my original post on LinkedIn . ...

July 20, 2025 路 1 min 路 72 words 路 Eduardo Potumati
An example showing implicit operator conversions in C# with potential pitfalls

Implicit Operators in C#: Convenience vs. Clarity

In C#, implicit operators enable automatic type conversions without the need for explicit casting. This functionality not only enhances code readability but also boosts development agility while safeguarding against runtime conversion exceptions. However, be careful. While implicit conversions offer convenience, excessive usage can potentially compromise code clarity. It鈥檚 essential to tread carefully as an overreliance on implicit conversions may obscure the precise moments and locations where conversions occur. 馃憠 Adapted from my original post on LinkedIn . ...

March 22, 2025 路 1 min 路 77 words 路 Eduardo Potumati
A code comparison showing a foreach loop converted into a LINQ expression

Convert a foreach Loop to LINQ

Convert a foreach loop to LINQ LINQ transforms a query into a first-class language construct in C#. It can reduce the amount of code, enhance readability, and enable similar query expression patterns across different data sources. 馃憠 Adapted from my original post on LinkedIn .

November 15, 2024 路 1 min 路 45 words 路 Eduardo Potumati
Code snippet demonstrating how to compare two numbers using Math.Abs in C#

Comparing Numbers with Tolerance in C#

Comparing Numbers with Tolerance in C# Sometimes, when comparing two numbers in C#, you may want to allow for a tolerance or interval in the comparison. Instead of manually adding, subtracting, and comparing the values, you can use Math.Abs on the difference between the two numbers to check if the result falls within your acceptable range. 馃憠 Adapted from my original post on LinkedIn .

September 15, 2024 路 1 min 路 65 words 路 Eduardo Potumati
Code snippet illustrating data transfer between controllers using TempData

TempData in ASP.NET Core: Transferring Data Between Controllers

TempData - Transfer data between controllers Ideal for transferring small amounts of data between controllers in ASP.NET MVC. Unlike ViewData and ViewBag, which are specific to a single view, TempData persists for one request cycle. This means the data remains available until it鈥檚 accessed, at which point it鈥檚 automatically removed. 馃憠 Adapted from my original post on LinkedIn .

August 15, 2024 路 1 min 路 59 words 路 Eduardo Potumati
Code snippet illustrating the UseRewriter middleware in ASP.NET Core

Handling Duplicate URLs in ASP.NET MVC: www vs non-www

Concerned about duplicate URLs in ASP.NET MVC? Take care of both www and non-www domains. .NET already provides the correct method to handle them. Using the UseRewriter middleware is the optimal approach. You can use AddRedirectToNonWww() or AddRedirectToWww() for this purpose. 馃憠 Adapted from my original post on LinkedIn .

July 15, 2024 路 1 min 路 50 words 路 Eduardo Potumati
Code snippet demonstrating pattern matching to protect against nulls in C#

Pattern Matching in C#: Getting Protected from Nulls

Pattern Matching: Get Protected from Nulls C# pattern matching provides a substantially more concise syntax for testing expressions and taking decisive action when an expression matches. By leveraging these structural features, you can gracefully bundle type checks, variable declarations, and null validations into a single, highly readable statement-significantly reducing boilerplate code and the risk of unexpected NullReferenceExceptions. 馃憠 Adapted from my original post on LinkedIn .

May 15, 2024 路 1 min 路 66 words 路 Eduardo Potumati
Code snippet demonstrating the differences between Round, Floor, and Ceiling in C#

Differences Between Round, Floor, and Ceiling in C#

Do you know the differences between Round, Floor, and Ceiling in C#? Round: It follows standard mathematical rounding to the nearest integer. For example, 5.67 => 6, and 5.47 => 5. Floor: It rounds the number down to the nearest integer. For example, 5.67 => 5, and 5.47 => 5. Ceiling: It rounds the number up to the nearest integer. For example, 5.67 => 6, and 5.47 => 6. 馃憠 Adapted from my original post on LinkedIn . ...

February 15, 2024 路 1 min 路 78 words 路 Eduardo Potumati