: (linq) microsoft visual basic 2008

: (linq) microsoft visual basic 2008
: ,
:

. . .*

.

- - ( )

LINQ. Microsoft Visual Basic 2008.

, MathCAD STATISTICA, , , . , , , . .

Microsoft .NET Framework Visual Studio. .NET Framework , . .NET Framework C#, Visual Basic, C++, Delphi, Nemerle, Python .

, 20 . , , Visual Basic 2005, > 0. , , , ForNext DoLoop ( ) IFEndIF SelectCase. GoTo, .

LINQ (Language Integrated Query) [1], Microsoft .NET Framework 3.5 2007 . ( 2006 .). .

, IEnumerable<(Of <(T) IQueryable<(Of <(T>)>)[2]. , (Array), (Collection), (Dictionary), (List) .. , LINQ Microsoft SQL Server 2005 (LINQ to SQL), DataSet (LINQ to DataSet), XML (LINQ to XML) Entities (LINQ to Entities) [3].

LINQ . , :

.

.

.

.

.

.

.

.

.

:

. . .

. , , , . , List(of Integer).

ForNext, (Integer, Double, Long), , ForEach.

: Intel Core2Duo E6550-2,3/4096 / MS Windows Vista Ultimate .

Microsoft Visual Basic 2008 Express, Microsoft.

Dim Result As New List(Of Integer)

For i As Integer = 0 To UBound(Vector)

If Vector(i) > 0 Then Result.Add(Vector(i))

Next

LINQ

Dim Query = From element In Vector Where element >= 0 _

Select element

.

Dim Result As New List(Of Integer)

For i As Integer = 0 To UBound(Vector)

If Vector(i) > 0 Then Result.Add(Vector(i))

Next

Result.Sort()

LINQ

Dim Query = From element In Vector Where element >= 0 _

Select element Order By element

Dim Result As New List(Of Integer)

For i As Integer = 0 To UBound(Vector)

Result.Add(Vector(i) ^ 2)

Next

LINQ

Dim Query = From element In Vector _

Select element ^ 2

Dim Result As New List(Of Integer)

Dim isOutput As Boolean = True

For i As Integer = 0 To UBound(Vector)

isOutput = True

For j As Integer = 0 To i

If i <> j And Vector(i) = Vector(j) Then

isOutput = False

Exit For

End If

Next

If isOutput = True Then Result.Add(Vector(i))

Next

LINQ

Dim Query = From element In Vector _

Select element Distinct

Dim count As Integer = 0

For i As Integer = 0 To UBound(Vector)

If Vector(i) < 0 Then count += 1

Next

LINQ

Dim Result As Integer = Aggregate Element In Vector _

Where Element < 0 Into Count()

Dim sum As Integer = 0

Dim average As Double = 0

Dim count As Integer = UBound(Vector) + 1

For i As Integer = 0 To count - 1

sum += Vector(i)

Next

average = sum / count

LINQ

Dim Result As Double = Aggregate Element In Vector _

Into Average()

.

Dim sum As Integer = 0

For i As Integer = 0 To UBound(Vector)

sum += Vector(i)

Next

LINQ

Dim Result As Integer = Aggregate Element In Vector _

Into Sum()

.

Dim max As Integer = Vector(0)

For i As Integer = 1 To UBound(Vector)

If Vector(i) > max Then max = Vector(i)

Next

LINQ

Dim Result As Integer = Aggregate Element In Vector _

Into Max()

LINQ, ,
1 1205 1324
2 62 6801
3 13791 14820
4 4330 209181
5 2137 592
6 1139 201
7 920 172
8 983 187

LINQ.

, LINQ .

( , , , ) LINQ , . ( , , , ) LINQ , .

LINQ 6200 5 - 2007 .

. LINQ // 2006. 4.

. .NET Framework Class Library // RSDN Magazine 2003. 6.

Paolo Pialorsi, Marco Russo. Introducing Microsoft LINQ. Microsoft Press. 2007.


* ..., . . .