您好,登錄后才能下訂單哦!
小編給大家分享一下VB.NET對(duì)象列表的示例分析,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
第一步步是要?jiǎng)?chuàng)建一個(gè)同用列表,你可以從多種途徑獲取數(shù)據(jù),但是最簡單的方法是添加。文本中,我們會(huì)編寫代碼以便為舉例中的集來分類。因此,下面我們就來講講創(chuàng)建集的代碼。首先,我需要一個(gè)能代表集中的bottle的對(duì)象。為此而編寫的代碼是完全符合標(biāo)準(zhǔn)的,而且事實(shí)上,vb.net 2008 express intellisense會(huì)為你寫好大部分的代碼。以下是我的VB.NET對(duì)象列表:
public class bottle "internalproperties"public property brand() as string public property name() as string public property category() as string public property size() as decimal public sub new( _ end sub end class 為了創(chuàng)建集,我需要添加項(xiàng)目: dim cabinet as list(of bottle) = _ "new list(of bottle)cabinet.add(new bottle( _ "castle creek", _ "uintah blanc", _ "wine", 750)) cabinet.add(new bottle( _ "zion canyon brewing company", _ "springdale amber ale", _ "beer", 355)) cabinet.add(new bottle( _ "spanish valley vineyards", _ "syrah", _ "wine", 750)) cabinet.add(new bottle( _ "wasatch beers", _ "polygamy porter", _ "beer", 355))cabinet.add(new bottle( _ "squatters beer", _ "provo girl pilsner", _ "beer", 355))
所有的這些都是vb.net1.0中的標(biāo)準(zhǔn)代碼。但是,要通過定義我們自己的bottle對(duì)象來注明。
以上是“VB.NET對(duì)象列表的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。