Skip to content

Commit ea7b3f6

Browse files
committed
Updated readme
1 parent 4bac2e3 commit ea7b3f6

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

FunctionalCsharp/readme.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,58 @@
11
# Functional C#
22

3-
* Examples based on following sources:
3+
## Definition of C# z WIKI
4+
* https://en.wikipedia.org/wiki/C_Sharp_(programming_language)
5+
* Multi-paradigm: structured, imperative, object-oriented, event-driven, task-driven, functional, generic, reflective, concurrent
6+
* https://www.amazon.com/Functional-Programming-write-better-code/dp/1617293954
7+
8+
9+
## Already build in
10+
* Delegates and lambdas (C# 3)
11+
```csharp
12+
persons.Where(p => p.IsRetired)
13+
```
14+
15+
* Static usings (C# 6)
16+
```csharp
17+
using static System.Math;
18+
double result = Pow(2, 3);
19+
```
20+
21+
* Nonnullable (C# 8)
22+
```csharp
23+
string? nickname = null;
24+
```
25+
26+
* Immutables (record C# 9+)
27+
```csharp
28+
public record Person(string Name, DateOnly BirthDate);
29+
```
30+
31+
* Pattern matching (C# 7-11)
32+
```csharp
33+
if (obj is string s) ...
34+
if (person is { Age: > 18, Name: var n }) ...
35+
var result = shape switch
36+
{
37+
Circle c => "circle",
38+
_ => "Unknown shape"
39+
}
40+
```
41+
42+
## The good parts
43+
* Linq lambas (Dotnet 3.5 2007) - tragedie představená v roce 2017: lokální funkce
44+
* Exception handling (Try object)
45+
* Result Type (https://dotnet.github.io/dotNext/features/core/result.html)
46+
* Option instead of Null (https://dotnet.github.io/dotNext/features/core/optional.html)
47+
* Discriminated unions (Most awaited feature) https://www.youtube.com/watch?v=tD46WVJ2h9I&ab_channel=NickChapsas
48+
49+
50+
## Examples Implementations
51+
* Used language-ext and OneOf nugets
52+
* Others: Functional.DotNet, Funcky, FunCs, Fambda, Farity or other exotic implementations like FuncSharp
53+
54+
55+
## Examples based on following sources
456
* [FuncSharp library](https://github.com/MewsSystems/FuncSharp)
557
* [The New Option and Result Types of C#](https://www.youtube.com/watch?v=aksjZkCbIWA)
658
* [Result pattern in medatr](https://goatreview.com/improving-error-handling-result-pattern-mediatr/)

0 commit comments

Comments
 (0)