concept custom type in category c#

appears as: custom types, custom type, A custom type
Functional Programming in C#: How to write better C# code

This is an excerpt from Manning's book Functional Programming in C#: How to write better C# code.

Your dynamically typed colleague listens in amazement, because those were the very words you patronized him with a few moments earlier. You’re not sure what she means exactly, so she starts to implement Age as a custom type that can only represent a valid value for an age.

Listing 3.1. A custom type that can only be instantiated with a valid value
public class Age { public int Value { get; } public Age(int value) { if (!IsValid(value)) throw new ArgumentException($"{value} is not a valid age"); Value = value; } private static bool IsValid(int age) => 0 <= age && age < 120; }