Skip to content

Instantly share code, notes, and snippets.

View VladimirReshetnikov's full-sized avatar

Vladimir Reshetnikov VladimirReshetnikov

View GitHub Profile
struct A
{
static void Main()
{
A x = x;
}
}
class C
{
public static void Foo(int? x)
{
if(x > int.MaxValue) { }
}
}
class C
{
public static void Foo(double? x)
{
if(x <= double.NaN) { }
}
}
class C
{
public static void Foo(int x)
{
const int max = int.MaxValue;
if (x <= max) { }
}
}
using System;
class Program
{
static void Main()
{
// Print all chars from char.MinValue to char.MaxValue, inclusive
for (char ch = char.MinValue; ch <= char.MaxValue; ch++)
{
Console.WriteLine(ch);
using System;
class C
{
void Foo<T>(T x)
{
if (x is Exception)
{
var y = (x as Exception).GetBaseException();
}
2.10029012483843065541358656514017065178479851127691422449912612385411241356413624990801635932583925743550448404630387012696119750835122512819338589515023102487679195000616137238528520550848109877483907055803719245497655155182891941301264241339836508487664205325101034782705274119314377432103676792355947789773486621691539062821973910731064353903189982730041107016045601204988980067509055221166587406242809015611819075841923021005385625949667703030277664034758324313580790244173922638591979318554212028691614954137409477253926555192568513014877262179038708099757825408439206260627383340281547262918157899397427234196449295885898647889331784012799018236651549063527557444074109380665484145031691156089316565366153511468694138088694310137459872157947042327211599880302202639797025928582169109153067879286041853181577765327120287484236806361500270402902059297124252886859209937782237914791309358892393125629968653070676118625927088654916625791921974783340862117128673355811541572152010517810270824442421
-0.1990284251538415592581715805850820414184318417199958312903800538110841548091689730554577064946522134557011117542195650211566401318548212631513721300336941759229744890439854964575054794126834117010562117711139918602030253101239289333296681681892337453124787809693689763210978806971754960648293963572282600667538250478320165286086826710624296134741513052967283748731851359820950644152431669402828982568556519947297768263195194724150864901735446988285610654221970730320103985614175229845804418771772460937674174308201700512312816077196375567836577387837532782854798904227899250874445211274931731554447756779676933590438722256004942451775205071639355161262083916936211683366510177641081759533759219399625159760715645483186013150691717365207523009944324642355182267133161448775911147329542528641058852063491166484159369578338498105528070730696899479968182661190008839713644873561029620008046724173499900342690459628184105583317384422134090009252340320444758498118558382894350435532894302251987922902230161
-6.1665252325192513801994672415450909679747097867356795481051555489006290129376683160428673889762767184015785536819361662038989674746986109680431915765144669691111025602624218920854935786179878784337146764245929283472061538759382784107257868054813220809414314097181328328235618698658461643204820233959067373133112232276433935903343037513874602148308660094131457170745684983218784322143934936146930525153976794950364861082634931318753797339997263983348604310209433639141630528347720072582867232482763274308026893150714141458393446358053223207751882925347834923366639361185613149194654861627790596651417390381127031379055536213847083108552333834390992705118017900093126399219730509993130943204979173346313316622856530711389922992208852991932498584771053059261168027883023910905031851494931829066693306409843964823514879677626882708067118207215516198179347287822172839769909277884615521148134623559344413135462312411611310025706957540249172374447195845531987205109165949578889611714377904935820695386210591
using System;
class C
{
static void Main()
{
const long x = -1;
long y = x;
Console.WriteLine(unchecked(long.MinValue / x));
Console.WriteLine(unchecked(long.MinValue / y));