namespace ExtensionExample; public static class Extensions { public static bool IsDownloadable(this OfferingType offeringType) { var validOfferings = new List<OfferingType>() { OfferingType.Template, OfferingType.Ebook, OfferingType.OfflineCourse }; return validOfferings.Contains(offeringType); } } public enum OfferingType { Course, Ebook, Book, Template, OfflineCourse, } public sealed record Product(int Id, OfferingType Type); public sealed class ProductHandler(ResourcesHelper resourcesHelper) { public void DoStuff(Product product) { if (product.Type.IsDownloadable()) { var fileName = resourcesHelper.GetDefaultDownloadFileName(product.Type); var downloadUrl = resourcesHelper.GetDownloadUrl(product.Type); } } } public sealed class ResourcesHelper { public string? GetDownloadUrl(OfferingType offeringType) { if (offeringType.IsDownloadable()) { // some code to do this... return "TODO: get the download URL"; } return null; } public string? GetDefaultDownloadFileName(OfferingType offeringType) { if (offeringType.IsDownloadable()) { // some code to do this... return "TODO: get the file name"; } return null; } }