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 MongoDB.Driver; | |
using MongoDB.Driver.Linq; | |
var filter = Builders<Document>.Filter.Gt(v => v.S, 1); | |
var settings = MongoClientSettings.FromConnectionString("mongodb://localhost:27017"); | |
foreach (var provider in Enum.GetValues<LinqProvider>()) | |
{ | |
settings.LinqProvider = provider; | |
Console.Write($"Provider {provider}: "); | |
try |
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
[Fact] | |
public void DictionaryPreservesInsertionOrder() | |
{ | |
var dictionary = new Dictionary<int, int>(); | |
dictionary.Add(0, 0); | |
dictionary.Add(1, 1); | |
dictionary.Remove(0); | |
dictionary.Add(2, 2); | |
Assert.Equal(new int[] { 1, 2 }, dictionary.Keys); | |
} |
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
// Filter only active items | |
record Item(DateTime ActiveUntil); | |
IReadOnlyCollection<Item> GetActiveItems(IEnumerable<Item> items) => items.Where(item => item.ActiveUntil > DateTime.Now).ToArray(); | |
/* ******************************************************************** */ | |
// Robustly perform an [idempotent] request until timeout is reached | |
void PerformRequestRobustly(TimeSpan timeout) | |
{ | |
var retryUntil = DateTime.UtcNow + timeout; |
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.Collections; | |
using System.Diagnostics.CodeAnalysis; | |
namespace OrderedDictionary | |
{ | |
internal class OrderedDictionary<TKey, TValue> : IDictionary<TKey, TValue> where TKey : notnull | |
{ | |
private readonly Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>> _dictionary = new(); | |
private readonly LinkedList<KeyValuePair<TKey, TValue>> _linkedList = new(); |
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
@"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\MSBuild.exe" /nologo /clp:DisableConsoleColor;NoSummary /v:m /p:TargetProject="%~f1" "%~dp0%WriteFrameworkVersions.targets" |
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
/// <summary> | |
/// Represents a 64-bit entity identifier. | |
/// </summary> | |
/// | |
/// <typeparam name="TEntity">The entity type.</typeparam> | |
/// | |
/// <threadsafety static="true" instance="true" immutable="true"/> | |
[System.ComponentModel.TypeConverter(typeof(EntityIdConverter))] | |
public struct EntityId<TEntity> : IEquatable<EntityId<TEntity>>, IComparable<EntityId<TEntity>> | |
where TEntity : class |
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
diff --git a/src/PerfView/CommandProcessor.cs b/src/PerfView/CommandProcessor.cs | |
index cda121c..1d71717 100644 | |
--- a/src/PerfView/CommandProcessor.cs | |
+++ b/src/PerfView/CommandProcessor.cs | |
@@ -562,17 +562,22 @@ namespace PerfView | |
ClrPrivateTraceEventParser.Keywords.Stack | |
)); | |
- // Used to determine what is going on with tasks. | |
- var netTaskStacks = stacksEnabled; |
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.Reflection; | |
using Dnet.Reflection; | |
using SimpleInjector; | |
using SimpleInjector.Diagnostics; | |
namespace Dnet.Composition.Composition |
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
public interface IA | |
{ | |
Task F(); | |
} | |
public class A : IA | |
{ | |
public async Task F() => await Task.Delay(0).ConfigureAwait(false); | |
} |
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
files: | |
"C:\\Users\\Administrator\\Documents\\installnetcore2.ps1": | |
content: | | |
if (!(Test-Path -path 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.0\')) { | |
$url = "https://download.microsoft.com/download/B/1/D/B1D7D5BF-3920-47AA-94BD-7A6E48822F18/DotNetCore.2.0.0-WindowsHosting.exe" | |
$path = "C:\Users\Administrator\Downloads\DotNetCore.2.0.0-WindowsHosting.exe" | |
(New-Object System.Net.WebClient).DownloadFile($url, $path) | |
&$path /quiet | |
Start-Sleep -s 5 | |
Remove-Item $path |