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.Runtime.InteropServices; | |
class Program | |
{ | |
static void Main() | |
{ | |
dynamic calc = Activator.CreateInstance(Marshal.GetTypeFromCLSID(new Guid(148736, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70))); | |
Console.WriteLine(calc.Evaluate("2+3*5")); | |
} |
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
private static bool IsSimpleBinaryOperator(SyntaxKind kind) | |
{ | |
switch (kind) | |
{ | |
case SyntaxKind.AddExpression: | |
case SyntaxKind.MultiplyExpression: | |
case SyntaxKind.SubtractExpression: | |
// ... more cases skipped ... | |
case SyntaxKind.RightShiftExpression: | |
return true; |
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 void Foo<T>(T x) | |
{ | |
if (x == null) // Possible compare of value type with 'null' | |
{ | |
} | |
} |
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.Linq; | |
class Program | |
{ | |
static void Main() | |
{ | |
if (true.Any is object) { } | |
if (ICloneable.Clone is object) { } | |
} |
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 A<T> | |
{ | |
static void Foo(T[] a) { } | |
class B : A<T> { } | |
class C<T> | |
{ | |
static void Foo() | |
{ |
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 A | |
{ | |
static void Main() | |
{ | |
var x = Foo<int> is Foo<int> is Foo<int>; // Will this parse successfully? | |
} | |
void Foo<T>() { } | |
} |
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
struct S | |
{ | |
int x; | |
S(int y) | |
{ | |
if (GetType is object) { } | |
if (Equals is object) { } | |
this.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; | |
static class Program | |
{ | |
static void Main() | |
{ | |
for (var ch = char.MinValue; ch <= char.MaxValue; ch++) | |
{ | |
Console.WriteLine(ch); | |
} |
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; | |
struct S | |
{ | |
ValueType x; | |
static void Main() | |
{ | |
var s = new S(); |
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 A<T> | |
{ | |
class B : A<int> | |
{ | |
} | |
class C : B | |
{ | |
C GetThis() | |
{ |