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.Diagnostics; | |
| using System.Runtime.InteropServices; | |
| using System.Text; | |
| namespace InspectClipboard; | |
| internal class Program | |
| { | |
| [STAThread] | |
| static void Main(string[] args) |
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 JetBrains.Rd.Reflection; | |
| namespace ParseHashMap; | |
| public class Program | |
| { | |
| private static int _counter; | |
| static void Main(string[] args) | |
| { |
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 ConsoleApp1; | |
| internal unsafe class Program | |
| { | |
| private struct StructWithFixedBuffer | |
| { | |
| public StructWithFixedBuffer() | |
| { | |
| } |
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; | |
| using Silhouette; | |
| using System.Runtime.InteropServices; | |
| using System.Xml.Linq; | |
| namespace JitProfiler; | |
| internal unsafe class CorProfiler : CorProfilerCallback4Base | |
| { | |
| private const string FileName = @"G:\JetBrains\jit_profiler.txt"; |
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 MODULES = new ActiveXObject("Scripting.Dictionary"); | |
| var n; // undefined | |
| MODULES.Add(n, "Test value"); | |
| var keys = new VBArray(MODULES.Keys()).toArray(); | |
| WScript.Echo("Array length: " + keys.length); | |
| WScript.Echo("Key at index 0: " + (keys[0] === undefined ? "undefined" : keys[0])); | |
| WScript.Echo("Is index 0 enumerable? " + (keys.hasOwnProperty(0) ? "Yes" : "No")); |
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
| #include <iostream> | |
| #include <windows.h> | |
| #include <processsnapshot.h> | |
| int main() | |
| { | |
| auto processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, 40092); | |
| if (processHandle == nullptr) |
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>net7.0</TargetFramework> | |
| <ImplicitUsings>enable</ImplicitUsings> | |
| <Nullable>enable</Nullable> | |
| <PublishAot>true</PublishAot> | |
| <IlcDisableReflection>true</IlcDisableReflection> | |
| </PropertyGroup> |
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 static Task WhenAllOrFaulted(params Task[] tasks) | |
| { | |
| var faultedContinuations = new Task[tasks.Length]; | |
| var faultedTask = new TaskCompletionSource<Task>(); | |
| for (int i = 0; i < tasks.Length; i++) | |
| { | |
| faultedContinuations[i] = tasks[i].ContinueWith(t => faultedTask.SetResult(t), TaskContinuationOptions.OnlyOnFaulted); | |
| } |
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 static Task WhenAllOrFaulted(params Task[] tasks) | |
| { | |
| var faultedContinuations = new Task[tasks.Length]; | |
| for (int i = 0; i < tasks.Length; i++) | |
| { | |
| faultedContinuations[i] = tasks[i].ContinueWith(_ => {}, TaskContinuationOptions.OnlyOnFaulted); | |
| } | |
| var faultedTask = Task.WhenAny(faultedContinuations); |
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
| [MethodImpl(MethodImplOptions.AggressiveOptimization)] | |
| static void SyncMethod() | |
| { | |
| // Run a garbage collection in 1 second | |
| Task.Delay(1000).ContinueWith(_ => { GC.Collect(); }); | |
| var taskCompletionSource = new TaskCompletionSource(); | |
| Action myDelegate = () => taskCompletionSource.SetResult(); |
NewerOlder