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
static extern void MyPInvoke(IntPtr ptrToCstr) | |
static void Main() | |
{ | |
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); | |
try | |
{ | |
MyPInvoke(ptr); | |
IntPtr cstrPtr = Marshal.PtrToStructure(ptr, typeof(IntPtr)) |
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
20000100000 | |
20000100000 | |
20000100000 | |
20000100000 | |
20000100000 | |
20000100000 | |
; Assembly listing for method Name.Program:IfeHelper(struct):long:this | |
; Emitting BLENDED_CODE for X64 CPU with AVX | |
; optimized code | |
; rbp based frame |
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
class C | |
{ | |
[DllImport...] | |
private static extern IntPtr GetAHandle(); | |
private static Task WrapHandle() | |
{ | |
var handle = GetAHandle(); | |
var tcs = new TaskCompletionSource(); | |
Task.Run(() => |
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 class C { | |
public void M() { | |
int x = 0; | |
{ | |
int y = 0; | |
// Captures two struct closures | |
int L() => x + y; | |
} | |
} |
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; | |
public class LoginResource : IEquatable<LoginResource> | |
{ | |
public string Username { get; set; } | |
public string Password { get; set; } | |
public bool RememberMe { get; set; } = false; | |
public override bool Equals(object obj) | |
=> obj is LoginResource resource && Equals(resource); |
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.Linq; | |
using BenchmarkDotNet.Attributes; | |
namespace misc_bench | |
{ | |
[MemoryDiagnoser] | |
public class Benchmarks |
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.Immutable; | |
using System.IO; | |
using System.Reflection; | |
using System.Reflection.Metadata; | |
using System.Reflection.Metadata.Ecma335; | |
using System.Reflection.PortableExecutable; | |
namespace default_impl | |
{ |
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.IO; | |
using System.Reflection.Metadata; | |
using System.Reflection.PortableExecutable; | |
try | |
{ | |
using var file = new FileStream(args[0], FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); | |
using var pe = new PEReader(file); |
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
ref struct S<#a> { | |
public int Field; | |
public ref<#a> int RefField; | |
} | |
static int StaticField = 5; | |
public void M1() { | |
S s = default; // S<#global> | |
s = new S() { RefField = ref StaticField }; |
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
interface IWebApplication<abstract TResult> | |
{ | |
TResult MapGet(string route, Func<TResult, TResult> f); | |
} | |
class NotFound : IResult { } | |
class OK<TValue> : IResult { } | |
class MyWebApp : IWebApplication<IResult> | |
{ |
OlderNewer