'nullable Sub Main() Dim i As Nullable(Of Integer) = Nothing End Sub が Sub Main() Dim i As Integer? = Nothing End Sub コンパイル通りません。 'ゆるいデリゲート Sub Main() Dim act As Action(Of String) ' a.act = New Action(Of String)(AddressOf ConsoleWriteLine) act = AddressOf ConsoleWriteLine act("100%中の100%") End Sub Sub ConsoleWriteLine(ByVal str As String) Console.WriteLine(str) End Sub '型推論 Dim a = 1 a = New Object() static void Main(string[] args) { var a = 1; int b = a + 10; } 'オブジェクト初期化子 Public Class Users Public ID As Integer Public Name As String End Class Sub Main() Dim a As New Users With {.ID = 10, .Name = "NAKA"} End Sub public class Wankuma { public int ID; public string Name; } class Program { static void Main(string[] args) { var a = new Wankuma{ID=1, Name="Naka"}; } } '配列初期化子 Public Class Users Public ID As Integer Public Name As String End Class Sub Main() Dim a() = {New Users With {.ID = 10, .Name = "NAKA"}, New Users With {.ID = 20, .Name = "NAKA2"}} Dim b() = {1, 2, 3, 4, 5} End Sub public class Wankuma { public int ID; public string Name; } class Program { static void Main(string[] args) { var a = new Wankuma[] { new Wankuma { ID = 1, Name = "Naka" }, new Wankuma { ID = 2, Name = "Naka2" } }; var b = new List { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; var c = new[]{ 1, 2, 3, 4, 5 }; } } '匿名型 Sub Main() Dim a() = {New With {.ID = 10, .Name = "NAKA"}, New With {.ID = 20, .Name = "NAKA2"}} End Sub static void Main(string[] args) { var a = new[]{ new{ ID = 10, Name = "NAKA" },new { ID = 20, Name = "NAKA2" } }; } '拡張メソッド Module Module1 Sub Main() Dim a As String = "ABC" a.toConsoleOut() End Sub End Module Module moda _ Sub ToConsoleOut(Of T)(ByVal [me] As T) Console.WriteLine([me]) End Sub End Module class Program { static void Main(string[] args) { "ABCDEFG".ToConsoleOut(); } } public static class Ext { public static void ToConsoleOut(this string value) { System.Console.WriteLine(value); } } 'ラムダ式 Lambda class Program { static void Main(string[] args) { var a = new List {"A", "B", "C", "D", "E"}; a.ForEach(delegate(string value) { Console.WriteLine(value); }); } } が class Program { static void Main(string[] args) { var a = new List {"A", "B", "C", "D", "E"}; a.ForEach(x => Console.WriteLine(x) ); } } 'LINQコトハジメ Sub Main() Dim TestData() = {New With {.Name = "NAKA", .Age = 31}, New With {.Name = "Shuujin", .Age = 25}, _ New With {.Name = "KOKA", .Age = 30}, New With {.Name = "Ognac", .Age = 20}} Dim ResultData = From o In TestData _ Where (o.Age > 29) _ Select o Dim ResultArray = ResultData.ToList() End Sub class Program { static void Main(string[] args) { var TestData = new[] {new {Name="NAKA", Age=31}, new {Name="Shuujin", Age=25}, new {Name="KOKA", Age=30}, new {Name="Ognac", Age=20}}; var ResultData = from o in TestData where o.Age > 29 select o; var ResultArray = ResultData.ToList(); } } 'LINQ1つ皮をはぐ static void Main(string[] args) { var TestData = new[] {new {Name="NAKA", Age=31}, new {Name="Shuujin", Age=25}, new {Name="KOKA", Age=30}, new {Name="Ognac", Age=20}}; //var ResultData = from o in TestData // where o.Age > 29 // select o; var ResultData = TestData .Where( x => x.Age > 29 ) .Select(x => x.Name ); var ResultArray = ResultData.ToList(); } 'さらにもう1枚 class Program { static void Main(string[] args) { var TestData = new[] {new {Name="NAKA", Age=31}, new {Name="Shuujin", Age=25}, new {Name="KOKA", Age=30}, new {Name="Ognac", Age=20}}; //var ResultData = from o in TestData // where o.Age > 29 // select o; var ResultData = TestData .Where2(x => x.Age > 29) .Select(x => x.Name); var ResultArray = ResultData.ToList(); } } public static class Ext { public static IEnumerable Where2(this IEnumerable value, Func predicate) { List listt = new List(); foreach (T t in value) { if (predicate(t) == true) { listt.Add(t); } } return listt; } } 'XMLDeep support Sub Main() Dim a = ab Dim b = a.ToString() Dim c() = {New With {.Name = "NAKA"}, New With {.Name = "Shuujin"}, New With {.Name = "Namerou"}} Dim f As XElement = <%= From d In c _ Where (d.Name.Contains("N")) _ Select _ <%= d.Name %> %> Dim g = f.ToString() Dim i = _ From h In c _ let cnt = Count (h) Select h.Name End Sub