Skip to content

Instantly share code, notes, and snippets.

@dresswithpockets
Created August 12, 2021 15:05
Show Gist options
  • Save dresswithpockets/62876e5696cdad6fac72221ade39ad56 to your computer and use it in GitHub Desktop.
Save dresswithpockets/62876e5696cdad6fac72221ade39ad56 to your computer and use it in GitHub Desktop.
using System;
using System.IO;
using System.Threading.Tasks;
public static class C {
public static (int, int) GetThing() => (1, 2);
public static void A1() {
GetThing();
}
public static void A2() {
(_, _) = GetThing();
}
public static void B1() {
var (a, b) = GetThing();
Console.WriteLine(a);
}
public static void B2() {
var (a, _) = GetThing();
Console.WriteLine(a);
}
}
.class private auto ansi '<Module>'
{
} // end of class <Module>
.class public auto ansi abstract sealed beforefieldinit C
extends [System.Private.CoreLib]System.Object
{
// Methods
.method public hidebysig static
valuetype [System.Private.CoreLib]System.ValueTuple`2<int32, int32> GetThing () cil managed
{
// Method begins at RVA 0x2050
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: newobj instance void valuetype [System.Private.CoreLib]System.ValueTuple`2<int32, int32>::.ctor(!0, !1)
IL_0007: ret
} // end of method C::GetThing
.method public hidebysig static
void A1 () cil managed
{
// Method begins at RVA 0x2059
// Code size 7 (0x7)
.maxstack 8
IL_0000: call valuetype [System.Private.CoreLib]System.ValueTuple`2<int32, int32> C::GetThing()
IL_0005: pop
IL_0006: ret
} // end of method C::A1
.method public hidebysig static
void A2 () cil managed
{
// Method begins at RVA 0x2059
// Code size 7 (0x7)
.maxstack 8
IL_0000: call valuetype [System.Private.CoreLib]System.ValueTuple`2<int32, int32> C::GetThing()
IL_0005: pop
IL_0006: ret
} // end of method C::A2
.method public hidebysig static
void B1 () cil managed
{
// Method begins at RVA 0x2064
// Code size 20 (0x14)
.maxstack 2
.locals init (
[0] int32 a
)
IL_0000: call valuetype [System.Private.CoreLib]System.ValueTuple`2<int32, int32> C::GetThing()
IL_0005: dup
IL_0006: ldfld !0 valuetype [System.Private.CoreLib]System.ValueTuple`2<int32, int32>::Item1
IL_000b: stloc.0
IL_000c: pop
IL_000d: ldloc.0
IL_000e: call void [System.Console]System.Console::WriteLine(int32)
IL_0013: ret
} // end of method C::B1
.method public hidebysig static
void B2 () cil managed
{
// Method begins at RVA 0x2084
// Code size 16 (0x10)
.maxstack 8
IL_0000: call valuetype [System.Private.CoreLib]System.ValueTuple`2<int32, int32> C::GetThing()
IL_0005: ldfld !0 valuetype [System.Private.CoreLib]System.ValueTuple`2<int32, int32>::Item1
IL_000a: call void [System.Console]System.Console::WriteLine(int32)
IL_000f: ret
} // end of method C::B2
} // end of class C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment