A bunch of random C# code snippets that might help.
- IsWeekend
- Check if DayOfWeek is Saturday or Sunday. (Note: This does not apply to all countries and cultures. I found it useful for Brazil.)
- ToFirstDayOfMonth
- Returns the first day of the month for the specified DateOnly/DateTime/DateTimeOffset.
- ToLastDayOfMonth
- Returns the last day of the month for the specified DateOnly/DateTime/DateTimeOffset.
- GetIso8601WeekNumber
- Returns the week of the year, according to ISO-8601, for the specified DateTime.
- ReadLinesAsync
- Returns an iterator to read a stream line by line
- Reverse
- Reverses a given string. e.g. ABCD => DCBA
- ToSnakeCase
- Convert string to snake_case format. e.g. CodeSnippets => code_snippets
- IsValidCnpj
- Check if the given string is a valid CNPJ.
- IsValidCpf
- Check if the given string is a valid CPF.