Add the code to an ASP.NET Core project to indicate the current page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.ComponentModel.DataAnnotations; | |
| /// <summary> | |
| /// Specifies a validation attribute that checks if the value of a property or field | |
| /// is greater than a specified minimum value. | |
| /// </summary> | |
| /// <remarks> | |
| /// This attribute is typically used to validate that a <see cref="DateTime"/> value | |
| /// is greater than the defined <see cref="Minimum"/> value. It is applied to properties | |
| /// or fields and ensures that the validation logic is enforced. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Text.Json; | |
| using FluentValidation.Results; | |
| namespace TODO.LanguageExtensions; | |
| /// <summary> | |
| /// Provides extension methods for FluentValidation to simplify validation and error handling. | |
| /// </summary> | |
| public static class FluentValidationExtensions | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using FluentValidation; | |
| namespace FluentWebApplication1.Validators; | |
| public static class RuleBuilderExtensions | |
| { | |
| /// <summary> | |
| /// Adds a validation rule to ensure that a nullable <see cref="DateOnly"/> property is not null | |
| /// and falls within a valid date range. | |
| /// </summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Spectre.Console; | |
| using System.Text; | |
| namespace BirthDay; | |
| internal partial class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| // 1) Force UTF-8 so emojis aren’t mangled into question marks | |
| Console.OutputEncoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "help": "https://go.microsoft.com/fwlink/?linkid=866610", | |
| "root": true, | |
| "dependentFileProviders": { | |
| "add": { | |
| "fileToFile": { | |
| "add": { | |
| "Client.Sets.cs": [ | |
| "Client.cs" | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static partial class Helpers | |
| { | |
| public static string NextValue1(string sender, int incrementBy = 1) | |
| { | |
| var index = sender.Length - 1; | |
| while (index >= 0 && char.IsDigit(sender[index])) | |
| index--; | |
| if (index == sender.Length - 1) | |
| return sender + incrementBy.ToString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AnsiConsole.MarkupLine("[yellow]Comma delimited full month names[/]"); | |
| CommaDelimitedStringCollection result1 = []; | |
| result1.AddRange(DateTimeFormatInfo.CurrentInfo.MonthNames[..^1]); | |
| Console.WriteLine($"{result1}"); | |
| AnsiConsole.MarkupLine("[yellow]Using an int array[/]"); | |
| int[] items = [1, 2, 3]; | |
| CommaDelimitedStringCollection result2 = new(); | |
| result2.AddRange(items.ToStringArray()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class DateTimeHelpers | |
| { | |
| /// <summary> | |
| /// Generates a list of dates representing the next week's dates starting from the upcoming Sunday. | |
| /// </summary> | |
| /// <returns>A list of <see cref="DateOnly"/> objects representing the dates of the next week.</returns> | |
| public static List<DateOnly> NextWeeksDates() | |
| { | |
| var start = DateTime.Now; | |
| var nextSunday = DateOnly.FromDateTime(start).Next(DayOfWeek.Sunday); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Serilog; | |
| using static System.DateTime; | |
| namespace TODO.Classes; | |
| public class SetupLogging | |
| { | |
| public static void Development() | |
| { |