SlideShare a Scribd company logo
1 of 17
可知 一輝
自己紹介
• ひとりでやってます(会社員ではないという意味で)
• 本名でやってます。
• Facebook:Kazuki.Kachi
• Twitter :@kazuki_kachi
何故に今VBなのか?
• VS2015とWindows10がRTMになって早1ヶ月、ですが、C#6.0なお話
はVS2015がCTPな頃からさんざん聞いて聞き飽きてるし、すでに書き
飽きている物と想像しています。
まあ、だったらVBかな?と(軽い気持ち)
• VBが終わったとか言わせないぞ!とかではありません。
• でも、そんなに悪い言語ではないと思うので忘れないで!
• 今回は、「広く」「浅く」追加された機能を紹介する予定です。
※深く知りたい場合は「C#」でググれば良いんじゃないかな…
と思ったんですが、
ねこが居なくなって、
やる気が…
昨日帰ってきました
アジェンダ
• 追加された機能
• 実は元々有った機能
• まとめ
ゴール
• VBも(ちゃんと使えば)悪くないと思っていただければ良いかなと。
.NET Compiler Platform(Roslyn)
(詳細は他の人に任せるとして)雑な解説
• コンパイラをManaged言語(C#はC#、VBはVB)で実装し直した。
• IDEのコード分析にも同じものを使用する(できる)ようにした。
• コード分析APIを公開した。(誰でも(割と簡単に)使える)
結果…
IDEの機能強化
• リファクタリングが提供された。
• ウォッチウインドウがΛ式、LINQの結果表示に対応した。
• 以下の機能がC#と同等になった
• (IDEが提供する)リファクタリングが強化された。
• ソリューションエクスプローラに「参照」dllが表示されるようになった。
これは2013のどこかのUpdateからかも(2013Update5では表示されている)
• SharedProjectに対応した。
Feature Example C# VB
Auto-property initializers public int X { get; set; } = x; Added Exists
Read-only auto-properties public int Y { get; } = y; Added Added
Ctor assignment to getter-only autoprops Y = 15 Added Added
Static imports using static System.Console; … Write(4); Added Exists
Index initializer new JObject { ["x"] = 3 } Added No
Await in catch/finally try … catch { await … } finally { await … } Added No
Exception filters catch(E e) when (e.Count > 5) { … } Added Exists
Partial modules Partial Module M1 N/A Added
Partial interfaces Partial Interface I1 Exists Added
Multiline string literals "Hello<newline>World" Exists Added
Year-first date literals Dim d = #2014-04-03# N/A Added
Comments after implicit line continuation Dim addrs = From c in Customers ' comment N/A Added
TypeOf ... IsNot ... If TypeOf x IsNot Customer Then … N/A Added
Expression-bodied members public double Dist => Sqrt(X * X + Y * Y); Added No
Null-conditional operators customer?.Orders?[5] Added Added
String interpolation $"{p.Name} is {p.Age} years old." Added Added
nameof operator string s = nameof(Console.Write); Added Added
#pragma #Disable Warning BC40008 Added Added
Smart name resolution N/A Added
Read-write props can implement read-only interface properties Exists Added
#Region inside methods Exists Added
Overloads inferred from Overrides N/A Added
CObj in attributes Exists Added
CRef and parameter name Exists Added
Extension Add in collection initializers Added Exists
Improved overload resolution Added N/A
この中で、VBに関係があるのは…
Feature Example
Read-only auto-properties public int Y { get; } = y;
Ctor assignment to getter-only autoprops Y = 15;
Null-conditional operators customer?.Orders?[5]
String interpolation $"{p.Name} is {p.Age} years old."
nameof operator string s = nameof(Console.Write);
#pragma #pragma warning disable
Partial interfaces Partial Interface I1
Multiline string literals "Hello<newline>World"
Read-write props can implement read-only interface properties
#Region inside methods
CObj in attributes
Partial modules Partial Module M1
Year-first date literals Dim d = #2014-04-03#
Comments after implicit line continuation Dim addrs = From c in Customers ' comment
TypeOf ... IsNot ... If TypeOf x IsNot Customer Then …
Smart name resolution
Overloads inferred from Overrides
こんな感じ
Read-only auto-properties
Ctor assignment to getter-only autoprops
Class Point
ReadOnly Property X As Integer
ReadOnly Property Y As Integer
ReadOnly Property Name As String = NameOf(Point)
Sub New(x As Integer, y As Integer)
Me.X = x
Me.Y = y
End Sub
End Class
Class Point
Private _x As Integer
ReadOnly Property X As Integer
Get
Return _x
End Get
End Property
Private _name As Integer
ReadOnly Property Name As String
Get
Return _x
End Get
End Property Sub New(x As Integer, y As Integer)
_name = “Point”
_x = x
End Sub
End Class
コンパイル時には上記のように解釈されます。
セッションではReadOnlyなPrivateフィールドに格納されると言ったな?
あれは嘘だ!(と言うか、C#は確かにreadonlyなフィールドに格納されるんだけど…)
まさか(こんなことが)違うとは思わず、確認を怠っておりました。申し訳ない…
Null-conditional operators
Private Sub IntroduceNullConditionalOperators(
ps As IReadOnlyList(Of Point),
Optional act As Action = Nothing)
Dim p = ps?(0) 'これはIndexer
Dim s = p?.ToString()
WriteLine(If(s, "Null"))
Dim x = p?.X
WriteLine(If(x.HasValue, x.ToString(), "Null"))
act?.Invoke() 'delegateの場合はInvoke()を使用する
End Sub
String interpolation
Private Sub IntroduceStringInterpolation()
Dim formated = $“{1000:C}” ‘String.Formatに展開される
WriteLine(formated) ‘(日本語環境での)実行結果は 1,000
With New Object()
Dim format1 As IFormattable = $"{1000:C}“
Dim ci = CultureInfo.GetCultureInfo("en-us")
WriteLine(format1.ToString(Nothing, ci)) ‘実行結果は$1,000.00
End With
End Sub
nameof operator
Private Sub IntroduceNameOf(Optional arg As String = Nothing)
If arg Is Nothing Then
Throw New ArgumentNullException(NameOf(arg))
End If
WriteLine($"{NameOf(arg)}:{arg}")
WriteLine("おまけ")
WriteLine($"{NameOf(DateTime.Now)}")
WriteLine($"{NameOf(DateTime)}")
WriteLine($"{NameOf(Date.Today)}")
'WriteLine($"{NameOf(Date)}") これはBuild error
End Sub
他の実例を挙げると、
INotifyPropertyChangedの実装でしょうか
今まで
Property FamilyName As String
(略)
Set(value As String)
If _familyName = value Then Return
_familyName = value
RaisePropertyChanged()
RaisePropertyChanged("FullName")
End Set
End Property
他にはExpression使ったり…
これから
Property FamilyName As String
(略)
Set(value As String)
If _familyName = value Then Return
_familyName = value
RaisePropertyChanged()
RaisePropertyChanged(NameOf(FullName))
End Set
End Property
こんなの書きまして、
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Sub RaisePropertyChanged(<CallerMemberName> Optional propertyName As String = Nothing)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
End Sub
Multiline string literals
Console.WriteLine("Hello
World")
Year-first date literals
Dim today = #2015-08-29# '年は1000以上でないとBuild error
Dim todayOnOldVersion = #08-29-2015# '年は100以上でないとBuild error
以上です。

More Related Content

Similar to Visual basic14 の話

C#言語機能の作り方
C#言語機能の作り方C#言語機能の作り方
C#言語機能の作り方信之 岩永
 
わんくま同盟大阪勉強会#61
わんくま同盟大阪勉強会#61わんくま同盟大阪勉強会#61
わんくま同盟大阪勉強会#61TATSUYA HAYAMIZU
 
.NET Compiler Platform
.NET Compiler Platform.NET Compiler Platform
.NET Compiler Platform信之 岩永
 
C++コミュニティーの中心でC++をDISる
C++コミュニティーの中心でC++をDISるC++コミュニティーの中心でC++をDISる
C++コミュニティーの中心でC++をDISるHideyuki Tanaka
 
Goコンパイラのきもち
GoコンパイラのきもちGoコンパイラのきもち
Goコンパイラのきもちmjhd-devlion
 
Favtile ~never write JS again~
Favtile ~never write JS again~Favtile ~never write JS again~
Favtile ~never write JS again~hanachin
 
今からでも遅くないC#開発
今からでも遅くないC#開発今からでも遅くないC#開発
今からでも遅くないC#開発Kazunori Hamamoto
 
objc2swift 〜 Objective-C から Swift への「コード&パラダイム」シフト
objc2swift 〜 Objective-C から Swift への「コード&パラダイム」シフトobjc2swift 〜 Objective-C から Swift への「コード&パラダイム」シフト
objc2swift 〜 Objective-C から Swift への「コード&パラダイム」シフトTaketo Sano
 
第2回勉強会スライド
第2回勉強会スライド第2回勉強会スライド
第2回勉強会スライドkoturn 0;
 
C++ tips2 インクリメント編
C++ tips2 インクリメント編C++ tips2 インクリメント編
C++ tips2 インクリメント編道化師 堂華
 
第3回BDD勉強会
第3回BDD勉強会第3回BDD勉強会
第3回BDD勉強会zakihaya
 
Pythonista による Pythonista のための Scala 紹介 in BPStudy #49
Pythonista による Pythonista のための Scala 紹介 in BPStudy #49Pythonista による Pythonista のための Scala 紹介 in BPStudy #49
Pythonista による Pythonista のための Scala 紹介 in BPStudy #49shoma h
 
C#や.NET Frameworkがやっていること
C#や.NET FrameworkがやっていることC#や.NET Frameworkがやっていること
C#や.NET Frameworkがやっていること信之 岩永
 
ChefとPuppetの比較
ChefとPuppetの比較ChefとPuppetの比較
ChefとPuppetの比較Sugawara Genki
 
How Smalltalker Works
How Smalltalker WorksHow Smalltalker Works
How Smalltalker WorksSho Yoshida
 
F#+Erlangで簡単なシューティングゲームを作ってみている
F#+Erlangで簡単なシューティングゲームを作ってみているF#+Erlangで簡単なシューティングゲームを作ってみている
F#+Erlangで簡単なシューティングゲームを作ってみているpocketberserker
 

Similar to Visual basic14 の話 (20)

C#言語機能の作り方
C#言語機能の作り方C#言語機能の作り方
C#言語機能の作り方
 
わんくま同盟大阪勉強会#61
わんくま同盟大阪勉強会#61わんくま同盟大阪勉強会#61
わんくま同盟大阪勉強会#61
 
.NET Compiler Platform
.NET Compiler Platform.NET Compiler Platform
.NET Compiler Platform
 
C++コミュニティーの中心でC++をDISる
C++コミュニティーの中心でC++をDISるC++コミュニティーの中心でC++をDISる
C++コミュニティーの中心でC++をDISる
 
Boost17 cpplinq
Boost17 cpplinqBoost17 cpplinq
Boost17 cpplinq
 
Goコンパイラのきもち
GoコンパイラのきもちGoコンパイラのきもち
Goコンパイラのきもち
 
Favtile ~never write JS again~
Favtile ~never write JS again~Favtile ~never write JS again~
Favtile ~never write JS again~
 
今からでも遅くないC#開発
今からでも遅くないC#開発今からでも遅くないC#開発
今からでも遅くないC#開発
 
objc2swift 〜 Objective-C から Swift への「コード&パラダイム」シフト
objc2swift 〜 Objective-C から Swift への「コード&パラダイム」シフトobjc2swift 〜 Objective-C から Swift への「コード&パラダイム」シフト
objc2swift 〜 Objective-C から Swift への「コード&パラダイム」シフト
 
C#勉強会
C#勉強会C#勉強会
C#勉強会
 
第2回勉強会スライド
第2回勉強会スライド第2回勉強会スライド
第2回勉強会スライド
 
C++ tips2 インクリメント編
C++ tips2 インクリメント編C++ tips2 インクリメント編
C++ tips2 インクリメント編
 
Deep Dive C# 6.0
Deep Dive C# 6.0Deep Dive C# 6.0
Deep Dive C# 6.0
 
第3回BDD勉強会
第3回BDD勉強会第3回BDD勉強会
第3回BDD勉強会
 
Pythonista による Pythonista のための Scala 紹介 in BPStudy #49
Pythonista による Pythonista のための Scala 紹介 in BPStudy #49Pythonista による Pythonista のための Scala 紹介 in BPStudy #49
Pythonista による Pythonista のための Scala 紹介 in BPStudy #49
 
C#や.NET Frameworkがやっていること
C#や.NET FrameworkがやっていることC#や.NET Frameworkがやっていること
C#や.NET Frameworkがやっていること
 
ChefとPuppetの比較
ChefとPuppetの比較ChefとPuppetの比較
ChefとPuppetの比較
 
C++ tips4 cv修飾編
C++ tips4 cv修飾編C++ tips4 cv修飾編
C++ tips4 cv修飾編
 
How Smalltalker Works
How Smalltalker WorksHow Smalltalker Works
How Smalltalker Works
 
F#+Erlangで簡単なシューティングゲームを作ってみている
F#+Erlangで簡単なシューティングゲームを作ってみているF#+Erlangで簡単なシューティングゲームを作ってみている
F#+Erlangで簡単なシューティングゲームを作ってみている
 

Recently uploaded

Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 

Recently uploaded (9)

Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 

Visual basic14 の話

  • 3. 何故に今VBなのか? • VS2015とWindows10がRTMになって早1ヶ月、ですが、C#6.0なお話 はVS2015がCTPな頃からさんざん聞いて聞き飽きてるし、すでに書き 飽きている物と想像しています。 まあ、だったらVBかな?と(軽い気持ち) • VBが終わったとか言わせないぞ!とかではありません。 • でも、そんなに悪い言語ではないと思うので忘れないで! • 今回は、「広く」「浅く」追加された機能を紹介する予定です。 ※深く知りたい場合は「C#」でググれば良いんじゃないかな…
  • 5. アジェンダ • 追加された機能 • 実は元々有った機能 • まとめ ゴール • VBも(ちゃんと使えば)悪くないと思っていただければ良いかなと。
  • 6. .NET Compiler Platform(Roslyn) (詳細は他の人に任せるとして)雑な解説 • コンパイラをManaged言語(C#はC#、VBはVB)で実装し直した。 • IDEのコード分析にも同じものを使用する(できる)ようにした。 • コード分析APIを公開した。(誰でも(割と簡単に)使える) 結果…
  • 7. IDEの機能強化 • リファクタリングが提供された。 • ウォッチウインドウがΛ式、LINQの結果表示に対応した。 • 以下の機能がC#と同等になった • (IDEが提供する)リファクタリングが強化された。 • ソリューションエクスプローラに「参照」dllが表示されるようになった。 これは2013のどこかのUpdateからかも(2013Update5では表示されている) • SharedProjectに対応した。
  • 8. Feature Example C# VB Auto-property initializers public int X { get; set; } = x; Added Exists Read-only auto-properties public int Y { get; } = y; Added Added Ctor assignment to getter-only autoprops Y = 15 Added Added Static imports using static System.Console; … Write(4); Added Exists Index initializer new JObject { ["x"] = 3 } Added No Await in catch/finally try … catch { await … } finally { await … } Added No Exception filters catch(E e) when (e.Count > 5) { … } Added Exists Partial modules Partial Module M1 N/A Added Partial interfaces Partial Interface I1 Exists Added Multiline string literals "Hello<newline>World" Exists Added Year-first date literals Dim d = #2014-04-03# N/A Added Comments after implicit line continuation Dim addrs = From c in Customers ' comment N/A Added TypeOf ... IsNot ... If TypeOf x IsNot Customer Then … N/A Added Expression-bodied members public double Dist => Sqrt(X * X + Y * Y); Added No Null-conditional operators customer?.Orders?[5] Added Added String interpolation $"{p.Name} is {p.Age} years old." Added Added nameof operator string s = nameof(Console.Write); Added Added #pragma #Disable Warning BC40008 Added Added Smart name resolution N/A Added Read-write props can implement read-only interface properties Exists Added #Region inside methods Exists Added Overloads inferred from Overrides N/A Added CObj in attributes Exists Added CRef and parameter name Exists Added Extension Add in collection initializers Added Exists Improved overload resolution Added N/A この中で、VBに関係があるのは…
  • 9. Feature Example Read-only auto-properties public int Y { get; } = y; Ctor assignment to getter-only autoprops Y = 15; Null-conditional operators customer?.Orders?[5] String interpolation $"{p.Name} is {p.Age} years old." nameof operator string s = nameof(Console.Write); #pragma #pragma warning disable Partial interfaces Partial Interface I1 Multiline string literals "Hello<newline>World" Read-write props can implement read-only interface properties #Region inside methods CObj in attributes Partial modules Partial Module M1 Year-first date literals Dim d = #2014-04-03# Comments after implicit line continuation Dim addrs = From c in Customers ' comment TypeOf ... IsNot ... If TypeOf x IsNot Customer Then … Smart name resolution Overloads inferred from Overrides こんな感じ
  • 10. Read-only auto-properties Ctor assignment to getter-only autoprops Class Point ReadOnly Property X As Integer ReadOnly Property Y As Integer ReadOnly Property Name As String = NameOf(Point) Sub New(x As Integer, y As Integer) Me.X = x Me.Y = y End Sub End Class
  • 11. Class Point Private _x As Integer ReadOnly Property X As Integer Get Return _x End Get End Property Private _name As Integer ReadOnly Property Name As String Get Return _x End Get End Property Sub New(x As Integer, y As Integer) _name = “Point” _x = x End Sub End Class コンパイル時には上記のように解釈されます。 セッションではReadOnlyなPrivateフィールドに格納されると言ったな? あれは嘘だ!(と言うか、C#は確かにreadonlyなフィールドに格納されるんだけど…) まさか(こんなことが)違うとは思わず、確認を怠っておりました。申し訳ない…
  • 12. Null-conditional operators Private Sub IntroduceNullConditionalOperators( ps As IReadOnlyList(Of Point), Optional act As Action = Nothing) Dim p = ps?(0) 'これはIndexer Dim s = p?.ToString() WriteLine(If(s, "Null")) Dim x = p?.X WriteLine(If(x.HasValue, x.ToString(), "Null")) act?.Invoke() 'delegateの場合はInvoke()を使用する End Sub
  • 13. String interpolation Private Sub IntroduceStringInterpolation() Dim formated = $“{1000:C}” ‘String.Formatに展開される WriteLine(formated) ‘(日本語環境での)実行結果は 1,000 With New Object() Dim format1 As IFormattable = $"{1000:C}“ Dim ci = CultureInfo.GetCultureInfo("en-us") WriteLine(format1.ToString(Nothing, ci)) ‘実行結果は$1,000.00 End With End Sub
  • 14. nameof operator Private Sub IntroduceNameOf(Optional arg As String = Nothing) If arg Is Nothing Then Throw New ArgumentNullException(NameOf(arg)) End If WriteLine($"{NameOf(arg)}:{arg}") WriteLine("おまけ") WriteLine($"{NameOf(DateTime.Now)}") WriteLine($"{NameOf(DateTime)}") WriteLine($"{NameOf(Date.Today)}") 'WriteLine($"{NameOf(Date)}") これはBuild error End Sub
  • 15. 他の実例を挙げると、 INotifyPropertyChangedの実装でしょうか 今まで Property FamilyName As String (略) Set(value As String) If _familyName = value Then Return _familyName = value RaisePropertyChanged() RaisePropertyChanged("FullName") End Set End Property 他にはExpression使ったり… これから Property FamilyName As String (略) Set(value As String) If _familyName = value Then Return _familyName = value RaisePropertyChanged() RaisePropertyChanged(NameOf(FullName)) End Set End Property こんなの書きまして、 Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged Sub RaisePropertyChanged(<CallerMemberName> Optional propertyName As String = Nothing) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName)) End Sub
  • 16. Multiline string literals Console.WriteLine("Hello World") Year-first date literals Dim today = #2015-08-29# '年は1000以上でないとBuild error Dim todayOnOldVersion = #08-29-2015# '年は100以上でないとBuild error