Top
image credit: Adobe Stock

.NET 7 Adds Generic Math

November 18, 2022

Via: InfoQ

In our last article we introduced generic parsing. This was a stepping stone to the real goal, generic math. Since .NET 2 was introduced in 2005, developers have been asking for an interface that supported basic arithmetical operations such addition and subtraction. This would allow them to build more complex mathematical libraries without the need to specify a particular type.

For example, one could write a function that calculated the standard deviation for a list of singles. Then that same function could be reused for doubles and halves instead of duplicating it.

Read More on InfoQ