September 30 2024

public class Person { public string Name { get; private set; } public Person(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Name cannot be null or whitespace.", nameof(name)); } Name = name; } }
public static class Ensure { public static void NotNullOrEmpty(string? value, string? paramName = null) { if(string.IsNullOrEmpty(value)) { throw new ArgumentException("The value can't be null", paramName); } } }
public Person(string name) { Ensure.NotNullOrEmpty(name); // Logic }
public static class Ensure { public static void NotNullOrEmpty(string? value, [CallerArgumentExpression("value")] string? paramName = null) { if(string.IsNullOrEmpty(value)) { throw new ArgumentException("The value can't be null", paramName); } } }
1. Design Patterns that Deliver
This isn’t just another design patterns book. Dive into real-world examples and practical solutions to real problems in real applications.Check out it here.
Go-to resource for understanding the core concepts of design patterns without the overwhelming complexity. In this concise and affordable ebook, I've distilled the essence of design patterns into an easy-to-digest format. It is a Beginner level. Check out it here.
Every Monday morning, I share 1 actionable tip on C#, .NET & Arcitecture topic, that you can use right away.
Join 18,000+ subscribers to improve your .NET Knowledge.
Subscribe to the TheCodeMan.net and be among the 18,000+ subscribers gaining practical tips and resources to enhance your .NET expertise.