Posts tagged with “c#”

Programming Tips on 01-04-2020

  1. safely convert Unix TimeStamp to string :
DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture.NumberFormat)

source

  1. DI with parameters in constructor
services.AddScoped<SmsSentLogRepo>(s => new SmsSentLogRepo(Configuration.GetConnectionString("sms")));
  1. You should use ConfigureAwait(false) in your library code. source