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> | |
/// Gets a shared semaphore to avoid loading multiple Win2D resources at the same time | |
/// </summary> | |
private static readonly SemaphoreSlim Win2DSemaphore = new SemaphoreSlim(1); | |
/// <summary> | |
/// Creates an effect brush that's similar to the official Acrylic brush in the Fall Creator's Update. | |
/// The pipeline uses the following effects: HostBackdropBrush > <see cref="LuminanceToAlphaEffect"/> > | |
/// <see cref="OpacityEffect"/> > <see cref="BlendEffect"/> > <see cref="ArithmeticCompositeEffect"/> > | |
/// <see cref="ColorSourceEffect"/> > <see cref="BorderEffect"/> with customizable blend factors for each couple of layers |
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> | |
/// A helper to await for events in an asynchronous manner. | |
/// </summary> | |
public static class EventAwaiter | |
{ | |
/// <summary> | |
/// Awaits a specific event to be raised and executes a callback when that happens. | |
/// </summary> | |
/// <typeparam name="THandler">The type of handler to await.</typeparam> | |
/// <param name="register">An <see cref="Action{T}"/> to register the event.</param> |
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.Diagnostics; | |
using System.Diagnostics.Contracts; | |
using System.Runtime.CompilerServices; | |
using System.Text; | |
#nullable enable | |
namespace Profiling | |
{ |
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.Windows.Input; | |
using Windows.UI.Xaml; | |
using Windows.UI.Xaml.Controls; | |
using Microsoft.Xaml.Interactivity; | |
#nullable enable | |
namespace Microsoft.Xaml.Interactions.Core | |
{ | |
/// <summary> |
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.Diagnostics.Contracts; | |
using System.Runtime.CompilerServices; | |
namespace System | |
{ | |
/// <summary> | |
/// A <see langword="class"/> with some extension methods for the <see cref="ReadOnlySpan{T}"/> type | |
/// </summary> | |
public static class ReadOnlySpanExtensions | |
{ |
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.Generic; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
namespace System | |
{ | |
/// <summary> | |
/// A <see langword="ref"/> <see langword="struct"/> that enumerates the items in a given <see cref="ReadOnlySpan{T}"/> instance | |
/// </summary> | |
/// <typeparam name="T">The type of items to enumerate</typeparam> |
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.Buffers; | |
using System.Diagnostics.Contracts; | |
using System.Runtime.CompilerServices; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
namespace MaxBenchmark | |
{ | |
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
// Custom delegate that takes the two ref parameters we need | |
public delegate void DataLoader(object instance, ref object r0, ref byte r1); | |
/* The method that takes a delegate and the list of discovered | |
* fields for the closure type and its nested closure types, | |
* and builds our dynamic IL method that loads all the fields sequentially */ | |
public static DataLoader BuildDataLoader( | |
Delegate instance | |
IReadOnlyList<ClosureField> fields) | |
{ |
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 static void Main() | |
{ | |
int[] array = new int[100]; | |
int value = 1; | |
Action<int> action = i => array[i] = value; | |
} |
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
[CompilerGenerated] | |
private sealed class <>c__DisplayClass0_0 | |
{ | |
public int[] array; | |
public int value; | |
internal void <Main>b__0(int i) | |
{ | |
array[i] = value; |
NewerOlder