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.Math; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
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; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
// This can be compiled. | |
// Looks like the compiler translates this "nameof" into the nameof expression on build time. | |
// However, the language service in Visual Studio interprets it as the private X.nameof method. | |
var name = nameof(Main); |
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 static System.Console; // using → using static | |
class Program | |
{ | |
static void Main() | |
{ | |
var x = int.Parse(ReadLine()); | |
WriteLine($"{nameof(x)} = {x}"); // "\{x}" → $"{x}" | |
} |
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.Diagnostics; | |
public class ArgListIsTooSlow | |
{ | |
static void Main(string[] args) | |
{ | |
const int N = 100000; | |
var sw = new Stopwatch(); |
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
git config --global alias.u2m '!git fetch upstream; git push origin upstream/master:master -f;' |
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 int X { get; set; } | |
} | |
class B | |
{ | |
public readonly A A = new A(); | |
} |
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 Point | |
{ | |
public int X { get; set; } | |
public int Y { get; set; } | |
} | |
class B | |
{ | |
public readonly Point P = new Point(); | |
} |
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 f = X(); | |
Console.WriteLine(f(1)); // 1 (value += 1) | |
Console.WriteLine(f(2)); // 3 (value += 2) | |
Console.WriteLine(f(3)); // 6 (value += 3) |
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 Point | |
{ | |
public int X { get; set; } | |
public int Y { get; set; } | |
} | |
class Program | |
{ |
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 Point | |
{ | |
public int X { get { return _x; } } | |
private readonly int _x; | |
public int Y { get { return _y; } } | |
private readonly int _y; | |
public Point(int x, int y) | |
{ |
OlderNewer