75 liens privés
You may need to integrate real-time updates in your .NET application from the backend to the frontend. You have a few options to implement this: Polling endpoints every few seconds can overload your…
A VitePress site
Using .NET 10’s Server-Sent Events TypedResults in Minimal APIs
After nearly a decade of working with .NET, I’ve learned that writing great code is only part of the journey. The real growth comes from debugging tough issues, refactoring messy legacy code, and learning from mistakes the hard way. From best practices to real-world insights, here are 20 essential tips that will help you write cleaner, more efficient, and scalable .NET applications. Whether you're just starting out or have years of experience, these lessons will make you a better .NET developer.
[LoggerMessage(
EventId = 0,
Level = LogLevel.Information,
Message = "Obtaining a basket from method {Method} for basket {basketId}")]
public partial void LogGetBasket(string Method, int basketId);
Learn how to map objects in .NET using various techniques and libraries and explore what is the best way to map objects in .NET in 2024
public List<string> ExtractHashtags(string content)
{
var hashtagPattern = new Regex(@"#\w+");
var matches = hashtagPattern.Matches(content);
return matches.Select(m => m.Value).ToList();
}
Fast .NET C# Implementation of ULID for .NET and Unity. - Cysharp/Ulid
Unlock the full potential of your ASP.NET Core applications with our definitive guide to middleware-based exception handling. Learn how to gracefully manage errors, boost your application's resilience, and protect against downtime with practical, easy-to-follow strategies
Photo by Sigmund on Unsplash In the recent four years I did quite a bit of web development also... Tagged with blazor, dotnet, javascript, webdev.
public static class StringExtensions
{
/// <summary>
/// Removes diacritics from the specified text.
/// </summary>
/// <param name="text">The text to remove diacritics from</param>
/// <returns>A new version of the text with diacritics removed</returns>
public static string RemoveDiacritics(this string text)
{
string normalizedString = text.Normalize(NormalizationForm.FormD);
var stringBuilder = new StringBuilder(normalizedString.Length);
foreach (char c in normalizedString)
{
if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)
{
stringBuilder.Append(c);
}
}
return stringBuilder.ToString();
}
}
pour aller plus loin
string diacriticCharacterText = "ÆßðáèîõüЌ؜";
string plainCharacterText = new string(diacriticCharacterText
.RemoveDiacritics()
.Where(char.IsAscii)
.ToArray());
Micro-framework for .NET console application. Cocona makes it easy and fast to build console applications on .NET.
https://www.youtube.com/watch?v=4KHFrbJHCHc
// wrong
IEnumerable<int> x = new Enumerable<int>();
//right
IEnumerable<int> x = Enumerable.Empty<int>();
string.Equals(str1, str2, StringComparison.OrdinalIgnoreCase);