Skip to content

Instantly share code, notes, and snippets.

// Declare constants with a searchable name
var MILLISECONDS_PER_DAY = 60 * 60 * 24 * 1000; //86400000;
clearBacklog(backlog, MILLISECONDS_PER_DAY);
// In the future we will not remember what 86400000 means.
clearBacklog(backlog, 86400000);
[Route("api/[controller]")]
public class SecurityController : Controller
{
private readonly IAntiforgery _antiforgery;
public SecurityController(IAntiforgery antiforgery)
{
_antiforgery = antiforgery;
}
public class ProductModel
{
[Display(Name = "Description:")]
[AllowHtml]
public string Description { get; set; }
}
<appSettings file="Web.SECRETS.config">
<add key="Database" value="someSecret" />
</appSettings>
<appSettings>
<add key="AWS" value="someSecret" />
<add key="Database" value="someKey" />
</appSettings>
// let's say you have a static method called GetProducts()
// that returns System.Data.DataTable
var products = GetProducts(ModelTypes.Subscription);
// how is it clear to the reader that I can do this?
return products.Compute("MAX(Price)", String.Empty);
public class FooController
{
public IActionResult Index()
{
var fooService = new FooService(new BarService(), new BazService());
return View(fooService.GetFoo());
}
}
list = (from ds in dbContext.bytehideServices
join c in dbContext.customer on ds.customerName equals c.customerName)
Where (ds.shield.number.IndexOf(productLicense.ShieldNumber, StringComparison.OrdinalIgnoreCase) != -1))
list = (from ds in dbContext.bytehideServices
join c in dbContext.customer on ds.customerName equals c.customerName)
where (ds.shield.number.ToLower().Contains(productLicense.ShieldNumber.ToLower()))