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; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
TestSetIntAtOffset(); | |
} | |
public static void TestSetIntAtOffset() |
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; | |
public class C { | |
public void TakeStruct<T>(T t) where T: struct | |
{ | |
} | |
public void Test() | |
{ | |
var someStruct = new SomeStruct(); | |
SomeStruct? someStructNullable = new SomeStruct(); |
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
// case 1 | |
public struct A : System.IDisposable | |
{ | |
public void Test() | |
{ | |
var a = new A(); | |
using (a) | |
a[0] = 0; // warning CS0728: Possibly incorrect assignment to local 'a' which is the argument to a using or lock statement. The Dispose call or unlocking will happen on the original value of the local. | |
} |
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; | |
class Program | |
{ | |
enum MyEnum { Zero } | |
static void Main(string[] args) { | |
Print(0.0f); | |
Print(0.1f); | |
} | |
static void Print(object a) { |
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
000002600F1020C0 push rbp | |
000002600F1020C1 mov rbp,rsp | |
000002600F1020C4 sub rsp,110h | |
000002600F1020CB mov qword ptr [rbp-78h],rsp | |
000002600F1020CF mov qword ptr [rbp-80h],rbp | |
000002600F1020D3 mov qword ptr [rbp-38h],rbx | |
000002600F1020D7 mov qword ptr [rbp-30h],rsi | |
000002600F1020DB mov qword ptr [rbp-28h],rdi | |
000002600F1020DF mov qword ptr [rbp-20h],r12 | |
000002600F1020E3 mov qword ptr [rbp-18h],r13 |
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
//#define USE_CUSTOM_COMPARER | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
public class Program | |
{ | |
private const int Iterations = 8000; | |
public 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
if (!value) | |
{ | |
AutoLock lock (&theLock); | |
if (!value) | |
{ | |
//... | |
value = /// | |
} | |
} |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace GenericConsoleTest | |
{ | |
class Base {} | |
class Derived : Base {} |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
class Experiment | |
{ | |
//ErrorsFor takes a hayStack, a bunch of needles, and is supposed to invoke errorMessage generator for everything | |
//in the haystack that matches a certain needle. As an excersice, i've been trying out all the different ways | |
//to write it, and evaluate for clarity, conciceness, readability by others, readability by me. | |
// |
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
Console.WriteLine (Math.Round (1.5)); | |
Console.WriteLine (Math.Round (2.0)); | |
Console.WriteLine (Math.Round (2.5)); | |
Console.WriteLine(); | |
Console.WriteLine (Math.Round (2.5)); | |
Console.WriteLine (Math.Round (3.0)); | |
Console.WriteLine (Math.Round (3.5)); | |
// Output | |
// 2 |
NewerOlder