とりこらぼ。

Learn from yesterday,
live for today,
hope for tomorrow.

目次

Blog 利用状況

ニュース

プロフィール

  • 名前:とりこびと
    とるに足らない人間です。

  • Wankuma MVP
    for '平々凡々'

Web Site

  • Memo(Of T)

もうひとつの Blog

広告っぽい

書庫

日記カテゴリ

Visual Basic 9.0 って、どんなんかーなぁー♪ その2。- Object and Array Initializers -

Visual Basic 9.0 って、どんなんかーなぁー♪ その1。- Implicitly Typed Local Variables -

今回は Object and Array Initializers についてです。

前回も登場のこのクラスがあったとして、

Public Class WankumaMember

    Private _id As Integer
    Public Property ID() As Integer         Get             Return _id         End Get         Set(ByVal value As Integer)             _id = value         End Set     End Property
    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
End Class
Object Initializer な機能を使用すると、
Dim torikobito As New WankumaMember With {.ID = 76, .Name = "とりこびと"}

どうやらこういうこと(?)らしいです。

なるほどなるほど・・・。インスタンスの生成時にプロパティとかフィールドに値を設定できるわけですね。見た目もそれっぽいですし、キーワードもWithです。んでもって Visual Basicで '{}' ですか!?w

もちろん前回の型推論と併用して、

Dim torikobito = New WankumaMember With {.ID = 76, .Name = "とりこびと"}

こんな感じでできるらしいです。

で、コレだけで終わらないのですよ。Object and Array Initializers ですから!「Array Initializerってなんですか?」ってことですが、

Dim members = { _
               New WankumaMember With {.ID = 12, .Name = "επιστημη"}, _
               New WankumaMember With {.ID = 28, .Name = "アクア"}, _
               New WankumaMember With {.ID = 33, .Name = "刈歩 菜良"}, _
               New WankumaMember With {.ID = 51, .Name = "ぽぴ王子"}, _
               New WankumaMember With {.ID = 76, .Name = "とりこびと"} _
               }

こんな感じです。WankumaMenber の配列 Members の初期化がこう↑なるそうです。

でもこれ・・・

Option Strict Off じゃないとダメっぽい・・・?

んでもってMembers はObject型の配列に・・・。orz



# 型指定できる Array Initializer な書き方がいいです。

投稿日時 : 2007年7月20日 13:58

Feedback

# re: Visual Basic 9.0 って、どんなんかーなぁー♪ その2。- Object and Array Initializers - 2007/07/20 16:28 シャノン

Array Initializer は WankumaMember って書かないとエラー?

# re: Visual Basic 9.0 って、どんなんかーなぁー♪ その2。- Object and Array Initializers - 2007/07/20 17:05 とりこびと

シャノンさん、コメントありがとうございます。

>Array Initializer は WankumaMember って書かないとエラー?

んと・・・要素の型のことでしょうか?
それとも
Dim members = WankumaMember() ...

ってことでしょうか?

# re: Visual Basic 9.0 って、どんなんかーなぁー♪ その2。- Object and Array Initializers - 2007/07/20 17:08 とりこびと

あ~、次回の話にかかる部分かな?
# Anonymous Types で書けるかな~。

# Visual Basic 9.0 って、どんなんかーなぁー♪ その3。- Anonymous Types - 2007/07/20 19:21 とりこびと ぶろぐ。

Visual Basic 9.0 って、どんなんかーなぁー♪ その3。- Anonymous Types -

# Visual Basic 9.0 って、どんなんかーなぁー♪ その3。- Anonymous Types - 2007/07/20 19:49 とりこびと ぶろぐ。

Visual Basic 9.0 って、どんなんかーなぁー♪ その3。- Anonymous Types -

# まあまあ厳しくして欲しい (3/3) ~現実は甘くない、けど楽しい~ 2007/11/01 18:33 とりこびと ぶろぐ。

まあまあ厳しくして欲しい (3/3) ~現実は甘くない、けど楽しい~

# <url>http://www.findacnetreatment.net/|accutane</url> 4901 <url>http://www.toprefinancequotes.com/|mortgage rates refinance</url> ichsj 2012/09/04 18:12 Kaylee

<url>http://www.findacnetreatment.net/|accutane</url> 4901 <url>http://www.toprefinancequotes.com/|mortgage rates refinance</url> ichsj

# <url>http://www.findacnetreatment.net/|accutane</url> 4901 <url>http://www.toprefinancequotes.com/|mortgage rates refinance</url> ichsj 2012/09/04 18:13 Kaylee

<url>http://www.findacnetreatment.net/|accutane</url> 4901 <url>http://www.toprefinancequotes.com/|mortgage rates refinance</url> ichsj

# <url>http://www.getinfectiontreatment.com/|doxycycline</url> 557569 <url>http://www.findacnetreatment.net/|accutane</url> upjmk <url>http://www.findyourcollegesonline.com/|online colleges</url> 99810 2012/09/23 19:02 Willie

<url>http://www.getinfectiontreatment.com/|doxycycline</url> 557569 <url>http://www.findacnetreatment.net/|accutane</url> upjmk <url>http://www.findyourcollegesonline.com/|online colleges</url> 99810

# <url>http://www.multipleinsurquotes.com/|insurance quotes</url> 70178 <url>http://www.findacnetreatment.net/|accutane buy</url> 8P <url>http://www.findyourcollegesonline.com/|online college</url> 50102 <url>http:/ 2012/09/27 14:35 Rangler

<url>http://www.multipleinsurquotes.com/|insurance quotes</url> 70178 <url>http://www.findacnetreatment.net/|accutane buy</url> 8P <url>http://www.findyourcollegesonline.com/|online college</url> 50102 <url>http://www.insuranceratesinminutes.com/|cheap car insurance</url> 98401

# <url>http://www.ohautoinsurancequotes.com/|car insurance rates</url> tmn <url>http://www.locateonlinecolleges.com/|online colleges</url> rtjj <url>http://www.insurforall.com/|life insurance</url> clgt <url>http:// 2012/10/31 8:52 Destrie

<url>http://www.ohautoinsurancequotes.com/|car insurance rates</url> tmn <url>http://www.locateonlinecolleges.com/|online colleges</url> rtjj <url>http://www.insurforall.com/|life insurance</url> clgt <url>http://www.getacheapcoverage.com/|car insurance quotes</url> 44052

# Cheap Sunglasses Ray Ban Sale Today 2015/04/09 22:57 blogs.wankuma.com

Packaging is very beautiful, looks very high-end glasses case, gave glasses cloth, carrying pouch, is on the grade, the overall feel good! Packaging is very beautiful, lightweight glasses shelves, not down to the nose, folding, the lens looks good, like.
Cheap Sunglasses Ray Ban Sale Today http://www.servicedapartments.org.sg/html/theapartments_content_needs.asp?id=e1762e57&Country=en_US&Sale=8f1e1fa2e&Page=Cheap-Sunglasses-Ray-Ban-Sale-Today

# Michael Kors Black Bag With Gold Chain Zales 2015/04/16 13:56 blogs.wankuma.com

Praise praise praise buy the number, it is more suitable for little mm. Can put down a lot of things, practical and good-looking, very black with red ride. Slight odor point, but for a day out on the loose, the cortex is also good. Bought two beige bag style is good, work well, no thread. Leather bag is a bit hard, like soap marked inside zipper pull, good packaging, logistics is also fast, or very satisfied.

# Nike San Diego Chrgers #39 Danny Woodhead Team Color NFL Elite Fanatical Version Jersey 2015/04/17 17:08 blogs.wankuma.com

Materials and workmanship are like, too fond of the quality is very good, a little time to catch up, thank the owner for help made a good luck, exactly the same description with the seller, very satisfied with the quality is very good, I bought all the best in a shirt fly in the ointment is without drawbacks quality is very good, is genuine, wear very comfortable fit.

# Cheap Oakley Eyepatch 2 Elad贸 2015/04/20 14:52 blogs.wankuma.com

My husband liked, affordable, value for money it is recommended to receive the baby very satisfied, and the seller described very consistent, bring handsome, a good shopping! Also to the next. Receive the baby very satisfied very satisfied. Is authentic! Eye bracket eye glasses case is a brand of cloth. Fantastic.

# Nike Elite NFL Jersey Sizing 2015/04/20 18:41 blogs.wankuma.com

Looks good quality hope will not fade! Now playing when you can wear, very comfortable, good quality, praise now look good, taste, do not know will not play ball wearing some now buy a good bargain, stockpile. Fabric is also good, this time to a friend bought.
Nike Elite NFL Jersey Sizing http://www.gulfaircenter.com/facebook/show/product/?id=96fe6bd8&Country=en_US&Sale=6adf9678c&Page=Nike-Elite-NFL-Jersey-Sizing

# Michael Kors Boots Size 10 2015/04/22 11:48 blogs.wankuma.com

Bag is absolutely genuine, good packaging, express delivery to force praise! Absolute leather bags and material well! Very stylish bag it looks good, leather is very soft, but the wealthy really big bag looks on the grade, color is also very positive, very satisfied with the bag looks pretty good. Quite like it. That is a little taste bag looks pretty atmosphere. Style is also good. Cheap. Bags looked good, work is also very good, is not imagine watching a large bag okay, is feeling a little old-fashioned, the bag can praise it, style is what I want. Logistics is also fast.

# Fake Oakley Sunglasses Antix Vestidos 2015/04/22 16:24 blogs.wankuma.com

Absolutely genuine goods! Trustworthy! Sunglasses quality is very good, like the style, wearing a really beautiful, very good quality sunglasses satisfied, is genuine, wearing a beautiful atmosphere, logistics and fast, very much like sunglasses quality is very good, but seem trendy retro style, wearing looks tall, the seller is very enthusiastic.
Fake Oakley Sunglasses Antix Vestidos http://www.atelierduparc.fr/?id=4c15710b&Country=en_US&Sale=7866b02a0&Page=Fake-Oakley-Sunglasses-Antix-Vestidos

# Gucci Store Nyc Sale 2015/04/23 3:32 blogs.wankuma.com

Very satisfied! Bags of good quality, workmanship impress, the price a bargain! Big Love! Praise! Bags of good quality, workmanship is very fine, and the same description of the picture! Very satisfied! Bags of good quality, careful workmanship, leather, leather is very good, beautiful style, wild bags good quality, good design is very suitable for work, fashionable, the seller shipped fast. Bags of good quality, workmanship is very fine. Merchant Services fine, logistics is also very timely.
Gucci Store Nyc Sale http://www.skmachineworks.com/facebook/show/product/?id=c491e1d9&Country=en_US&Sale=231eca0b8&Page=Gucci-Store-Nyc-Sale

# Mlb Out Of Market Map 2015/04/24 9:49 blogs.wankuma.com

Very comfortable to wear something received, good, very like, very comfortable to wear, it can stretch the opening movement, the next time there is a need to, will continue to buy things received, good stuff, thanks boss gifts, logistics is also very to the force, I wish the business booming.
Mlb Out Of Market Map http://ickestreeservice.com/facebook/show/product/?id=3e77e2b3&Country=en_US&Sale=07ae41a7f&Page=Mlb-Out-Of-Market-Map

# 2013 MLB All Star National League Milwaukee Brewers 27 Carlos Gomez Orange MLB Jerseys 2015/04/27 6:00 blogs.wankuma.com

Jersey received, just the right size, good quality, reasonable price, delivery is also very fast, the seller service attitude is very good, there is a need to receive in buying shirts, just the right size, quality can be, next time to buy shirts received, just the right size to fit, work is also very good, the service is good.
2013 MLB All Star National League Milwaukee Brewers 27 Carlos Gomez Orange MLB Jerseys http://www.paquet.be/entreprise.php?id=7ef84fd7&Country=en_US&Sale=282fc72a9&Page=2013-MLB-All-Star-National-League-Milwaukee-Brewers-27-Carlos-Gomez-Orange-MLB-Jerseys

# Dark Green Oakley Sunglasses Hut 2015/04/28 1:56 blogs.wankuma.com

This is a sophisticated optical design, fine workmanship, fashionable and very satisfied with the store fast delivery, baby packaging is very good, quality is also very good, the polarizing effect is also very good stores, fast delivery, baby received, fine workmanship, beautiful color very satisfied, let friends buy one, praise.
Dark Green Oakley Sunglasses Hut http://www.jka.us.com/facebook/show/product/?id=efaff597&Country=en_US&Sale=46cf9819d&Page=Dark-Green-Oakley-Sunglasses-Hut

# Burberry Tailoring History 2015/04/28 4:49 blogs.wankuma.com

New also does not come back zayang cortex in general, to the right in the assessment, hey, a waste of money really good, give a full 5 points praise, whether cash back 3 yuan Please stores grasp. Really good. Quality is also very good in the store to buy more than strong.
Burberry Tailoring History http://www.milanclubmons.be/milan.php?id=a5fdb90f&Country=en_US&Sale=59a090845&Page=Burberry-Tailoring-History

# New York Islanders #91 John Tavares Light Blue Stitched NHL Jersey 2015/04/29 12:16 blogs.wankuma.com

Next will come the seller attitude is very good, oh, express delivery is also very fast, very good shirt, jersey seller good attitude is also good, the seller gave the captain's armband seller good attitude is also good quality jersey given a breath 10 sets and patient seller good attitude, things are good, there are gifts.
New York Islanders #91 John Tavares Light Blue Stitched NHL Jersey http://www.kotsaridis.be/entete3.php?id=a2d25299&Country=en_US&Sale=9bbba67a2&Page=New-York-Islanders-#91-John-Tavares-Light-Blue-Stitched-NHL-Jersey

# Ed Reed New York Jets Jersey 2015/05/02 14:00 blogs.wankuma.com

Of course, this price has been very good, you can not expect too much, but I hope to be able to improve it. Overall satisfaction, give praise. Shipped quickly, logistics also to the force. No color, good permeability.
Ed Reed New York Jets Jersey http://www.blue-sun.be/bancs.php?id=44cbfc65&Country=en_US&Sale=c8b9c8552&Page=Ed-Reed-New-York-Jets-Jersey

# Ray Ban Flip Out 3460 2015/05/03 4:49 blogs.wankuma.com

To see things very clearly comfortable, very satisfied. Very beautiful baby, trendy, though I do not drive, but still buy polarized, can block the glare, the effect is very good, even made a polarized test card, very much, will come.
Ray Ban Flip Out 3460 http://francoscasualitalianrestaurant.com/delta/CVStore/2015/View/Discount/?id=70c0b556&Country=en_US&Sale=9b86dff4d&Page=Ray-Ban-Flip-Out-3460

# Oakley Mx Goggles Clearance 2015/05/04 17:39 blogs.wankuma.com

http://www.optipura.com/customers.php?City_Of_Oakley_Map.htmlCity Of Oakley Map
Oakley Mx Goggles Clearance http://www.mcema.net/jobs/job_occupation/2015/store/sale/?id=5ce8b366&Country=en_US&Sale=a41c91e68&Page=Oakley-Mx-Goggles-Clearance

# tBJwbZJpmWDCplD 2017/02/19 20:56 JimmiXzSw

pvYrp7 http://www.FyLitCl7Pf7ojQdDUOLQOuaxTXbj5iNG.com

タイトル
名前
Url
コメント