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 | |
{ | |
public class B : A { } | |
} | |
partial class C : A.B { } | |
partial class C : A.B.B { } | |
partial class C : A.B.B.B { } | |
partial class C : A.B.B.B.B { } |
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 | |
{ | |
public class B { } | |
} | |
class G<T> : A { } | |
partial class C : G<int>.B { } | |
partial class C : G<int[]>.B { } | |
partial class C : G<int[][]>.B { } |
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; | |
class A | |
{ | |
static void Main() | |
{ | |
var a = DateTime.Now.Add(TimeSpan.FromHours(1)); | |
} | |
} |
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.Security; | |
using System.Security.Permissions; | |
class B | |
{ | |
[X(SecurityAction.Demand)] | |
public B() { } | |
} |
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; | |
class Program | |
{ | |
static void Main() | |
{ | |
Foo(null); | |
} | |
static void Foo(params string[] 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
using System; | |
using System.Numerics; // Add a reference to System.Numerics.dll | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
class Program | |
{ | |
static void Main() | |
{ | |
Console.WriteLine(Factorial(15000)); |
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; | |
class Base | |
{ | |
private string x = "x".Print(); | |
} | |
class Derived : Base | |
{ | |
private string y = "y".Print(); |
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; | |
class Program | |
{ | |
static void Main() | |
{ | |
var x = Main as Action; | |
} | |
} |
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 Program | |
{ | |
unsafe static void Main() | |
{ | |
void* x = null; | |
var y = (int?) x; | |
var z = x as int?; // error CS0244: Neither 'is' nor 'as' is valid on pointer types | |
} | |
} |
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; | |
class A | |
{ | |
static void Main() | |
{ | |
const int age = 25; | |
const short newAge = 25; | |
Console.WriteLine(age == newAge); // True | |
Console.WriteLine(newAge.Equals(age)); // True |