C#
C# 3.0で唯一いらないもの既存のクラスにメソッドを追加できる using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Program { // intにHogeメソッドを追加 public static class IntExtention { public stati…
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Program { class Program { static void Main(string[] args) { var persons = new[] { new { Age = 22, Name = "Akira" }, new { Age = 38, Name = "Bob…
指定したプロパティを持つクラスを匿名で作成する using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Program { class Program { static void Main(string[] args) { var person = new { Age = 22, Name = …
型推論によってコンパイル時に決定される型 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Program { class Program { static void Main(string[] args) { var n = 3; int value = n; var ar = new List<int></int>…
プロパティを指定した初期化ができる using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Program { class Hoge { public int Age { get; set; } public string Name { get; set; } public void Disp() { Co…
流行りに乗ってたまにはC#でもやりましょう プロパティが簡単に書けるようになる using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Program { class Hoge { public int Age { get; set; } public string N…