Skip to content

Add frequently used utility extensions to string, enumerable, and date helpers - #1

Draft
joecklau with Copilot wants to merge 2 commits into
masterfrom
copilot/add-frequently-used-features
Draft

Add frequently used utility extensions to string, enumerable, and date helpers#1
joecklau with Copilot wants to merge 2 commits into
masterfrom
copilot/add-frequently-used-features

Conversation

Copilot AI commented Mar 2, 2026

Copy link
Copy Markdown

Fills common gaps in the existing utility library with lightweight, idiomatic extension methods across three areas.

String (TextUtil)

  • IsNullOrEmpty / IsNullOrWhiteSpace — extension-method shorthands
  • ToIntOrDefault, ToDecimalOrDefault, ToDoubleOrDefault — safe-parse with fallback value
  • Repeat(count) — repeat a string N times
  • ToBase64 / FromBase64 — UTF-8 ↔ Base64, null-safe

Enumerable (EnumerableExtensions)

  • IsNullOrEmpty<T>() — null-safe empty check
  • ForEach<T>(Action<T>) — in-line side-effect iteration

Date (DateExtensions)

  • StartOfDay — complement to existing EndOfDay
  • StartOfMonth / EndOfMonth — first/last moment of the month (EndOfMonth reuses EndOfDay for consistency)
  • IsWeekend / IsWeekday — day-type predicates
  • AddWorkDays(int) — advance by N business days, skipping weekends; supports negative values

Usage example

// Safe parse
int qty = "42".ToIntOrDefault();          // 42
int bad = "abc".ToIntOrDefault(-1);       // -1

// Enumerable
items.ForEach(x => x.Process());
if (list.IsNullOrEmpty()) return;

// Date
var monthEnd  = DateTime.Today.EndOfMonth();   // last day 23:59:59
var nextBizDay = DateTime.Today.AddWorkDays(1);

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…ensions

Co-authored-by: joecklau <9245713+joecklau@users.noreply.github.com>
Copilot AI changed the title [WIP] Add frequently used features to enhance user experience Add frequently used utility extensions to string, enumerable, and date helpers Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants