This file contains 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 BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Configs; | |
using BenchmarkDotNet.Diagnosers; | |
using BenchmarkDotNet.Environments; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Running; | |
using BenchmarkDotNet.Toolchains.CsProj; | |
using static Modified.Extensions; | |
public class Program |
This file contains 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; | |
using System.Text.Json.Serialization; | |
string json = """ | |
{ | |
"ISBN:9780544003415": { | |
"bib_key": "ISBN:9780544003415", | |
"info_url": "https://openlibrary.org/books/OL26885115M/The_lord_of_the_rings" | |
} | |
} |
This file contains 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.Collections.Immutable; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Diagnosers; | |
using BenchmarkDotNet.Running; | |
public class Program | |
{ | |
static void Main() => BenchmarkRunner.Run<Benchmark>(); |
This file contains 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 var stream = File.OpenText(@"C:\Users\Svick\Desktop\iso-639-3.tab"); | |
using var reader = new CsvReader(stream, new(CultureInfo.InvariantCulture) { Delimiter = "\t" }); | |
var dict = reader.GetRecords(new { Id = "", Ref_Name = "" }).ToDictionary(x => x.Id, x => x.Ref_Name); | |
CultureInfo.GetCultures(CultureTypes.NeutralCultures) | |
.Where(c => c.TwoLetterISOLanguageName.Length > 2 && (!dict.TryGetValue(c.TwoLetterISOLanguageName, out string isoName) || isoName != c.EnglishName)) | |
.Select(c => new { c.Name, c.TwoLetterISOLanguageName, c.EnglishName, IsoName = dict[c.TwoLetterISOLanguageName] }) | |
.Dump(); |
This file contains 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
void Main() | |
{ | |
using var context = new WarehouseContext(); | |
context.Database.EnsureDeleted(); | |
context.Database.EnsureCreated(); | |
var apple = new Product { Name = "Apple" }; | |
var pear = new Product { Name = "Pear" }; | |
context.Products.AddRange(apple, pear); | |
This file contains 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; | |
var x = new S3Options { Bucket = "root" }; | |
var y = new S3Options { I = 42 }; | |
Console.WriteLine(y.Bucket); | |
public struct S3Options | |
{ | |
public string Bucket { get; init; } | |
public int I { get; init; } = 0; |
This file contains 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>net5.0</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.Build" Version="16.11.0" ExcludeAssets="runtime" /> | |
<PackageReference Include="Microsoft.Build.Locator" Version="1.4.1" /> |
This file contains 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>net5.0</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.11.0" /> | |
<PackageReference Include="Microsoft.NET.HostModel" Version="3.1.16" /> |
This file contains 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
#nullable enable | |
public static class JavaScriptExtensions | |
{ | |
public static IEnumerator<(string name, object? value)> GetEnumerator(this object js) | |
{ | |
var properties = js.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public); | |
foreach (var property in properties) | |
{ | |
yield return (property.Name, property.GetValue(js)); |
This file contains 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 BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Diagnosers; | |
using BenchmarkDotNet.Running; | |
public class Program | |
{ | |
static void Main() => BenchmarkRunner.Run<Benchmark>(); | |
} |
NewerOlder