diff --git a/README.md b/README.md index 6187c7a..df46357 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ValueOf lets you define ValueObject Types in a single line of code. Use them everywhere to strengthen your codebase. -``` +```csharp public class EmailAddress : ValueOf { } ... @@ -23,7 +23,7 @@ The ValueOf class implements `.Equals` and `.GetHashCode()` for you. You can use C# 7 Tuples for more complex Types with multiple values: -``` +```csharp public class Address : ValueOf<(string firstLine, string secondLine, Postcode postcode), Address> { } ``` @@ -32,7 +32,7 @@ You can use C# 7 Tuples for more complex Types with multiple values: You can add validation to your Types by overriding the `protected void Validate() { } ` method: -``` +```csharp public class ValidatedClientRef : ValueOf { protected override void Validate() @@ -46,4 +46,4 @@ public class ValidatedClientRef : ValueOf ## See Also -If you liked this, you'll probably like another project of mine [OneOf](https://github.com/mcintyre321/OneOf) which provides Discriminated Unions for C#, allowing stronger compile time guarantees when writing branching logic. \ No newline at end of file +If you liked this, you'll probably like another project of mine [OneOf](https://github.com/mcintyre321/OneOf) which provides Discriminated Unions for C#, allowing stronger compile time guarantees when writing branching logic.