Skip to content

Commit c0a6361

Browse files
committed
added example for usage of parameterName in README
1 parent 6ede9e2 commit c0a6361

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ Every extension method of Light.GuardClauses has three optional parameters: **pa
6161
* **message** lets you exchange the entire exception message if you are not satisfied with the default message in your current context.
6262
* **exception** lets you specify a delegate creating an exception object that is thrown instead of the default exception.
6363

64+
```csharp
65+
public class ConsoleWriter
66+
{
67+
private readonly ConsoleColor _foregroundColor;
68+
69+
public ConsoleWriter(ConsoleColor foregroundColor = ConsoleColor.Black)
70+
{
71+
foregroundColor.MustBeValidEnumValue(parameterName: nameof(foregroundColor));
72+
73+
_foregroundColor = foregroundColor;
74+
}
75+
}
76+
```
77+
6478
```csharp
6579
public class Entity
6680
{

0 commit comments

Comments
 (0)