Skip to content

Commit

Permalink
Added a non-enum example.
Browse files Browse the repository at this point in the history
You can switch on any object or value type.
  • Loading branch information
mrstebo committed Feb 19, 2018
1 parent 6b5ac40 commit 1b41447
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -33,6 +33,20 @@ p my_variable # Outputs: Dang!

This package adds a similar behaviour by chaining methods:

```cs
const int myValue = 2;

var result = myValue.Switch()
.When(1, "Not this one?")
.When(2, "Dang!")
.Else("David Brent")
.Value();

Console.WriteLine(result); // Outputs: Dang!
```

***It can even work with enums***

_Enums_
```cs
public enum MyTestEnum
Expand Down

0 comments on commit 1b41447

Please sign in to comment.