Vb. List of useful common objects in net

Source: Internet
Author: User

To use list (of T), we need to know how to deploy. NET Framework provides a variety of methods. This is what this article will be about. I've written three examples--using foreach, FindAll, and sort--to illustrate how the same list class works.

The first step is to create a shared list. You can get data from a variety of sources, but the easiest way is to add it. Text, we'll write code to categorize the set in the example. So, let's talk about the code that creates the set.

First, I need an object that can represent the bottle of a set. The code written for this is perfectly compliant, and in fact, VB.net 2008 Express IntelliSense will write most of the code for you. The following are my objects:

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

To create a set, I need to add a project:

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))

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.