This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var flag = 0; | |
var stopwatch = new Stopwatch(); | |
ParameterizedThreadStart task = p => { | |
SpinWait.SpinUntil(() => Interlocked.CompareExchange(ref flag, 1, 0) == 0); | |
Console.WriteLine($"[{stopwatch.Elapsed}] Thread {p} has entered lock."); | |
Thread.Sleep(2000); | |
Console.WriteLine($"[{stopwatch.Elapsed}] Thread {p} is exiting lock."); | |
Interlocked.Exchange(ref flag, 0); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace AspNetCoreApp | |
{ | |
public class AdminSettings | |
{ | |
public AdminSettings() { } | |
// copy constructor | |
public AdminSettings(AdminSettings other) | |
{ | |
AdminEmail = other.AdminEmail; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.EntityFrameworkCore; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.Extensions.Logging.Console; | |
namespace test | |
{ | |
public abstract class EntityBase | |
{ | |
public int Id { get; set; } | |
public byte[] RowVersion { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Microsoft.Extensions.Configuration; | |
namespace Sample | |
{ | |
class Program | |
{ | |
static readonly IConfiguration Configuration = new ConfigurationBuilder() | |
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace netcore | |
{ | |
class Program | |
{ | |
static async Task TestAsync() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using LinqToDB; | |
using LinqToDB.EntityFrameworkCore; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace ConsoleApp1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp3.1</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Karambolo.Extensions.Logging.File" Version="3.1.1" /> | |
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.3" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Running; | |
namespace MyBenchmarks | |
{ | |
[SimpleJob(RuntimeMoniker.NetCoreApp31)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImprovedAstVisitor : AstVisitor | |
{ | |
protected virtual bool RewriteArrowFunctions => true; | |
protected override void VisitArrayExpression(ArrayExpression arrayExpression) | |
{ | |
for (int i = 0, n = arrayExpression.Elements.Count; i < n; i++) | |
{ | |
Expression element = arrayExpression.Elements[i]; | |
if (element != null) |