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.Text.Json.Serialization; | |
var builder = WebApplication.CreateSlimBuilder(args); | |
builder.Services.ConfigureHttpJsonOptions(options => | |
{ | |
options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default); | |
}); | |
var app = builder.Build(); |
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>net8.0</TargetFramework> | |
<ImplicitUsings>enable</ImplicitUsings> | |
<Nullable>enable</Nullable> | |
</PropertyGroup> | |
</Project> |
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.Runtime.CompilerServices; | |
class Test | |
{ | |
static int count = 0; | |
static void Main() | |
{ | |
for (int i = 0; i < Environment.ProcessorCount; i++) |
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.Runtime.CompilerServices; | |
new Thread(() => F_0_0()).Start(); | |
new Thread(() => F_1_0()).Start(); | |
new Thread(() => F_2_0()).Start(); | |
new Thread(() => F_3_0()).Start(); | |
new Thread(() => F_4_0()).Start(); | |
new Thread(() => F_5_0()).Start(); | |
new Thread(() => F_6_0()).Start(); | |
new Thread(() => F_7_0()).Start(); |
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.Runtime.InteropServices; | |
partial class Program | |
{ | |
static void Main() => Console.WriteLine(MyMethod()); | |
[LibraryImport("MyLibrary")] | |
private static partial int MyMethod(); | |
} |
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; | |
class G0<T> { } | |
class G1<T> { } | |
class G2<T> { } | |
class G3<T> { } | |
class G4<T> { } | |
class G5<T> { } | |
class G6<T> { } | |
class G7<T> { } | |
class G8<T> { } |
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; | |
struct ArrayWrapper<T> | |
{ | |
T[] _value; | |
public ArrayWrapper(T[] value) { _value = value; } | |
#if true | |
public static readonly ArrayWrapper<T> Empty = new ArrayWrapper<T>(Array.Empty<T>()); |
This file has been truncated, but you can view the full file.
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.Tasks; | |
class Test | |
{ | |
static async Task Main() | |
{ | |
int start = Environment.TickCount; | |
await M1000(); | |
int end = Environment.TickCount; |
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.Tasks; | |
class Program | |
{ | |
static async ValueTask<int> Step(int i) | |
{ | |
if (i >= 999) | |
await Task.Delay(1); | |
else |
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.Tasks; | |
class Program | |
{ | |
static async ValueTask<int> Step(int i) | |
{ | |
if (i >= 999) | |
await Task.Delay(1); | |
else |
NewerOlder