SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 56 | Next

Scott Klein

"Professional LINQ"

It includes a filter expression (the where clause), and ends with a select clause, which
projects (selects) the data gathered in the from clause.
Visual Basic
The following shows the previous example in Visual Basic .NET syntax:
Dim val As IEnumerable(Of String) = From fn in firstname _
Where fn.StartsWith("S") _
Select fn
Implicitly Typed Variables
Finally! Where has this been, I have to ask! Until now, you have had to explicitly specify a type when
declaring and initializing a variable. No more. Now you can infer the type assignment by simply using
the var keyword, as shown in the following examples.
C#
In C#, variables are implicitly typed as follows:
var firstname = "Scott";
var age = 28; //I wish!
var startdate = DateTime.Today;
So, why is this important, you ask? Because any variables declared as var are equally strongly typed as
their explicitly declared counterparts. And, even more importantly, this includes LINQ query
expressions. Stay tuned.
Visual Basic
Visual Basic also lets you implicitly type variables, but it does this by inferring the type of the variable
from the type of the initialization expression.


Pages:
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6