やじゅ@アプリケーション・ラボ わんくま支局

目次

Blog 利用状況

ニュース

プロフィール

MSMVP

Visual Basic 2015以降の新機能 その2

これは、Visual Basic Advent Calendar 2014の12/11日の記事。

VB2015(VB14.0)の新機能として下記9項目を挙げたのですが、幾つかの機能については次のVB15.0以降になるようです。
やはり、この時点でVisual Studio 2015 Preview版に実装されていないのは持ち越しのようです。
.NET Compiler Platform ("Roslyn") のサイトにて「Added」の項目は追加されています。

 

【VB2015(VB14.0)の新機能】参照:VBの新しいステートメントUpcoming Features in Visual Basic
1.Select Caseステートメントの拡張 → 次バージョンにて実装予定
2.読み取り専用の自動実装プロパティー
3.複数行にまたがった文字リテラル
4.yyyy-MM-dd型の日付リテラル
5.バイナリーリテラル
6.数値区切りリテラル
7.複数行にまたがるステートメントに対するコメント
8.バグ修正と小さな変更
9.C# Previewの変更で検討中の機能
10.その他

2.読み取り専用の自動実装プロパティーについて説明します。
この機能はVisual Studio 2015 Preview版を確認できました。
もともとC#では実装されていた機能なのですが、VBには実装されていませんでした。
簡単にプロパティー実装の経緯から説明します。

VB2008までのプロパティ実装の例
Private _name As String Public Property Name() As String Get Return _name End Get Set(ByVal value As String) _name = value End Set End Property

VB2010の自動実装プロパティの例

Public Property Name As String

このようにVB2010では、Propertyキーワードによりシンプルに宣言出来るようになりました。

このときVBコンパイラは、「_Name」というアンダーバー+プロパティ名のPrivate変数に展開します。
このPrivate変数を「バッキングフィールド」と呼びます。
これまでも変数を宣言する際に、ReadOnlyキーワードをつけることによって読み取り専用変数を宣言することが出来たのですが、プロパティにはついては、悲しいかなReadOnlyキーワードを付けるとコンパイルエラーになっておりました。
ちなみに、C#で読み取り専用プロパティは、public string Name {get; private set; } とします。 

VB2015ではプロパティをReadOnlyキーワードをつけて読み取り専用にでき、またコンストラクタでその値をセットできるようになっています。
Class Sample
    ReadOnly Property p As Integer = 15
    ReadOnly Property q As Integer

    Sub New(q As Integer)
        _q = q
    End Sub
End Class

Sub Main()
    Dim hoge As New Sample(1)

    Debug.Print(hoge.p.ToString) ’15
    Debug.Print(hoge.q.ToString) ’1
End Sub

投稿日時 : 2014年12月11日 1:55

コメントを追加

# bimatoprost generic 2021/12/12 20:49 Travislyday

http://bimatoprostrx.com/ bimatoprost buy

# best place to buy careprost 2021/12/13 16:28 Travislyday

https://bimatoprostrx.com/ careprost bimatoprost ophthalmic best price

# Hello my friend! I wish to say that this post is amazing, great written and include almost all vital infos. I'd like to peer extra posts like this . 2021/12/23 17:38 Hello my friend! I wish to say that this post is a

Hello my friend! I wish to say that this post is amazing, great written and include
almost all vital infos. I'd like to peer extra posts like this
.

# stromectol pill http://stromectolabc.com/
ivermectin drug 2022/02/08 2:54 Busjdhj

stromectol pill http://stromectolabc.com/
ivermectin drug

# ivermectin ebay http://stromectolabc.com/
ivermectin canada 2022/02/08 16:45 Busjdhj

ivermectin ebay http://stromectolabc.com/
ivermectin canada

# ivermectin ebay http://stromectolabc.com/
ivermectin canada 2022/02/08 16:45 Busjdhj

ivermectin ebay http://stromectolabc.com/
ivermectin canada

# doxycycline 100mg https://doxycyline1st.com/
how to order doxycycline 2022/02/26 20:13 Doxycycline

doxycycline 100mg https://doxycyline1st.com/
how to order doxycycline

# lOtPambMwNnfzOoyblG 2022/04/19 12:27 johnansaz

http://imrdsoacha.gov.co/silvitra-120mg-qrms

# ウブロコピー 2022/10/03 5:40 sktsovcklk@live.jp

注文してから、とても早く届きました。決済方法がカードが使えると、もっと便利だと思います。でも振込みの確認は早くすぐ発送してくれた迅速さには、楽しみにしていた商品なので嬉しかったです。メールでの対応もとても丁寧にしていただきました。
★ルイヴィトン★モノグラム★ソローニュ★M42250・斜め掛け★
念願かなって・・
欲しかったヴィトンのソローニュ。でも新品を買うには経済力が・・という私。一度オークションで手に入れかけたのですが、トラブル&偽物で叶わずでした。そしてこちらで購入。Aランクとあった通り、品物はきれいでもちろん間違いなく本物でした。これから愛用したいと思います。
ウブロコピー https://www.bagraku.com/bagraku19/master/

# facebook dating site https://datingtopreview.com/
free dating site 2022/10/17 20:42 Dating

facebook dating site https://datingtopreview.com/
free dating site

# prednisone for cheap https://prednisonepills.site/
prednisone 1mg purchase 2022/11/28 23:57 Prednisone

prednisone for cheap https://prednisonepills.site/
prednisone 1mg purchase

# dating free chating https://datingsiteonline.site/
serious free dating sites 2022/12/05 23:52 Tading

dating free chating https://datingsiteonline.site/
serious free dating sites

# single date online https://datingonlinehot.com/
online payment sites 2022/12/09 19:24 Dating

single date online https://datingonlinehot.com/
online payment sites

# cheapest ed pills https://edpills.science/
cheapest ed pills online 2023/01/07 13:54 EdPills

cheapest ed pills https://edpills.science/
cheapest ed pills online

# gel per erezione in farmacia https://viasenzaricetta.com/# 2023/04/16 9:15 ViaSenza

gel per erezione in farmacia https://viasenzaricetta.com/#

# buy cytotec pills online cheap - https://cytotecsale.pro/# 2023/04/28 23:35 Cytotec

buy cytotec pills online cheap - https://cytotecsale.pro/#

# buy ed pills online https://edpills.ink/# - best ed treatment pills 2023/07/26 20:09 EdPills

buy ed pills online https://edpills.ink/# - best ed treatment pills

# free singles 2023/08/09 13:29 WayneGurry

free sites of dating: https://datingtopreview.com/# - italian dating sites

# Abortion pills online 2023/08/27 20:38 Georgejep

https://misoprostol.guru/# Abortion pills online

# buy cytotec in usa 2023/08/28 21:00 Georgejep

https://misoprostol.guru/# buy cytotec

# Anna Berezina 2023/09/19 10:50 Mathewelego

Anna Berezina is a honoured inventor and demagogue in the area of psychology. With a background in clinical feelings and far-flung study circumstance, Anna has dedicated her calling to arrangement sensitive behavior and mental health: https://mozillabd.science/wiki/Get_to_Know_Anna_Berezina_A_Skilled_Desktop_Support_Technician. By virtue of her form, she has мейд important contributions to the battleground and has become a respected thought leader.

Anna's expertise spans different areas of emotions, including cognitive of unsound mind, favourable looney, and zealous intelligence. Her voluminous understanding in these domains allows her to stock up valuable insights and strategies exchange for individuals seeking offensive increase and well-being.

As an initiator, Anna has written several controlling books that drink garnered widespread perception and praise. Her books tender functional advice and evidence-based approaches to aide individuals decoy fulfilling lives and reveal resilient mindsets. Via combining her clinical expertise with her passion on serving others, Anna's writings have resonated with readers for everyone the world.

# farmacie online autorizzate elenco 2023/09/25 9:41 Archieonelf

http://farmaciaonline.men/# acquistare farmaci senza ricetta

# farmacia online migliore 2023/09/26 10:50 Archieonelf

http://pharmacieenligne.icu/# Pharmacie en ligne livraison 24h

# online apotheke deutschland 2023/09/26 14:38 Williamreomo

http://onlineapotheke.tech/# internet apotheke
versandapotheke

# online apotheke gГјnstig 2023/09/26 23:04 Williamreomo

https://onlineapotheke.tech/# п»?online apotheke
online apotheke gГ?nstig

# versandapotheke deutschland 2023/09/27 0:00 Williamreomo

https://onlineapotheke.tech/# online apotheke versandkostenfrei
online apotheke deutschland

# online apotheke preisvergleich 2023/09/27 2:29 Williamreomo

http://onlineapotheke.tech/# online apotheke preisvergleich
online apotheke gГ?nstig

# gГјnstige online apotheke 2023/09/27 3:48 Williamreomo

https://onlineapotheke.tech/# versandapotheke
online apotheke gГ?nstig

# п»їonline apotheke 2023/09/27 7:41 Williamreomo

https://onlineapotheke.tech/# versandapotheke
п»?online apotheke

# п»їonline apotheke 2023/09/27 9:17 Williamreomo

http://onlineapotheke.tech/# versandapotheke versandkostenfrei
online apotheke preisvergleich

# farmacie online sicure 2023/09/27 16:18 Rickeyrof

acheter sildenafil 100mg sans ordonnance

# what is the best ed pill https://edpillsotc.store/# - best medication for ed 2023/10/07 21:19 EdPills

what is the best ed pill https://edpillsotc.store/# - best medication for ed

# prescription from canada 2023/10/17 2:44 Dannyhealm

Their global distribution network is top-tier. https://mexicanpharmonline.shop/# mexican border pharmacies shipping to usa

# canadianrx 2023/10/17 3:16 Dannyhealm

I value their commitment to customer health. https://mexicanpharmonline.com/# pharmacies in mexico that ship to usa

# rx canada 2023/10/17 3:48 Dannyhealm

Their commitment to international standards is evident. http://mexicanpharmonline.com/# mexico drug stores pharmacies

# safe canadian pharmacies 2023/10/17 7:05 Dannyhealm

Their loyalty points system offers great savings. http://mexicanpharmonline.com/# mexican mail order pharmacies

# canada drug stores 2023/10/17 22:56 Dannyhealm

The best place for health consultations. https://mexicanpharmonline.shop/# mexican mail order pharmacies

# mexican pharmacies that ship to usa 2023/10/18 5:09 Dannyhealm

Hassle-free prescription transfers every time. http://mexicanpharmonline.com/# pharmacies in mexico that ship to usa

# canadian oharmacy 2023/10/18 15:05 Dannyhealm

World-class service at every touchpoint. https://mexicanpharmonline.shop/# mexico drug stores pharmacies

# erectile dysfunction pills 2023/11/20 13:18 WilliamApomb

http://tadalafil.trade/# tadalafil mexico

# top rated ed pills 2023/11/23 9:21 WilliamApomb

https://sildenafil.win/# lowest price for sildenafil 20 mg

# doxycycline 100mg online https://doxycycline.forum/ doxycycline hyclate 100 mg cap 2023/11/25 9:11 Doxycycline

doxycycline 100mg online https://doxycycline.forum/ doxycycline hyclate 100 mg cap

# acquisto farmaci con ricetta https://farmaciait.pro/ acquisto farmaci con ricetta 2023/12/04 7:08 Farmacia

acquisto farmaci con ricetta https://farmaciait.pro/ acquisto farmaci con ricetta

# prednisone 20 mg tablet price https://prednisonepharm.store/ prednisone 20mg 2024/01/20 12:58 Prednisone

prednisone 20 mg tablet price https://prednisonepharm.store/ prednisone 20mg

# eva elfie https://evaelfie.pro/ eva elfie izle 2024/03/03 6:02 EvaElfia

eva elfie https://evaelfie.pro/ eva elfie izle

# sweetie fox https://sweetiefox.pro/ - ph sweetie fox
2024/03/06 17:36 SwitieFox

sweetie fox https://sweetiefox.pro/ - ph sweetie fox

タイトル
名前
URL
コメント