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
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
Code diagram comparing struct and class memory allocation in .NET

Struct or Class: When to Use Which in C#

Struct or class? Most types in a framework should be classes, but there are some situations in which the characteristics of a value type make it more appropriate to use structs. Here are some things to consider: 馃憤 If your instances are small and short-lived, or commonly embedded in other objects, consider using a struct. 馃憥 However, be cautious when defining a struct. Only use it if the type represents a single value, is immutable, has an instance size under 16 bytes, and will not need to be boxed frequently. ...

December 15, 2023 路 1 min 路 125 words 路 Eduardo Potumati