TGViewer
Programming & AI Tips 💡 Programming & AI Tips 💡 @programmingtip · 46.3K subscribers
Post #382 4.24K
5 More C# Extension Methods for the Stocking ➕ A Bonus Method For Enums ! 💥


1️⃣ ToInt() ➖
We always have the familiar .ToString(), but what happens when we want to convert a simple string to an integer❓

🔹🔸🔹

2️⃣ OrdinalSuffix() ➖
This extension method places a 'th', 'st', 'nd', 'rd', or 'th' to the end of the number. 🔚

🔸🔹🔸

3️⃣ Occurrence() ➖
This just counts the number of occurrences in a string. 🔍

🔹🔸🔹

4️⃣ Join<T>()/Join() ➖
With this extension method, you can take an array or List<string>() and make a comma-delimited list in no time or build a broken-up URL with dashes as the URL name. ✅

🔸🔹🔸

5️⃣ ToQueryString() ➖
Have you ever wanted to take a NameValueCollection and convert it into a query string for a URL ? 🌐

🔹🔸🔹

⚡️ Enums.ToList<T>() - Bonus Method ➖

This Enums.ToList<T> static method is meant to take enumerations with description attributes and convert them into a NameValueCollection for possibly a dropdown. 📜

🔸🔹🔸

https://t.me/pgimg/96

[ Article ] : http://bit.do/chex

〰〰〰〰〰〰
#CSharp #ExtensionMethod
@ProgrammingTip
Telegram Programming Tips Resources
More from @programmingtip
  1. Oct 6, 2026Cloudflare shipped a Web Search API ⚡️ Cloudflare introduced a Web Search API. Search can…
  2. Oct 5, 2026AI is changing the developer career ladder 🚀 GitHub's latest developer career advice is r…
  3. Oct 2, 2026GPT-6 Astra gets an Ultrafast API tier 🚀 OpenAI added an Ultrafast speed tier for GPT-6 A…
  4. Oct 1, 2026Cloudflare shipped an agentic CLI for its API ⚡️ Cloudflare launched cf, an agentic CLI fo…
  5. Sep 30, 2026OpenAI introduced Dots, always-on agents 🚀 OpenAI introduced Dots, its take on always-on…
  6. Sep 29, 2026Claude Sonnet 5.5 is built for coding agents 🚀 Anthropic released Claude Sonnet 5.5 for t…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →