Skip to content

Instantly share code, notes, and snippets.

View nadjibus's full-sized avatar

Nadjib Bait nadjibus

  • Independant .NET/Xamarin Developer
  • UAE
View GitHub Profile
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Reflection;
public class Program
{
public static void Main(string[] args)
{
BenchmarkRunner.Run(typeof(Program).Assembly);
}
@nadjibus
nadjibus / LocalizeTagHelper.cs
Created November 2, 2022 21:07
An ASP.NET Core Tag Helper that makes localization pretty straightforward
using Microsoft.AspNetCore.Razor.TagHelpers;
[HtmlTargetElement(LocalizeTagName)] // This is for <localize>Content here</localize> syntax
[HtmlTargetElement(Attributes = LocalizeTagName)] // This is for <p localize>Content here</p> syntax, which I personally prefer
public class LocalizeTagHelper : TagHelper
{
private const string LocalizeTagName = "localize";
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{