| VB301_01_01 - Nullable Data Types |
|
|
Nullable data types allow you to create data types like integers and initialize them to nothing. This becomes important in the LINQ story because you will occasionally have a database table design that allows for a numeric field to be nullable, and prior to Visual Basic 9.0 you would have to turn a null value from your database into a zero value in your application. To avoid this mismatch in LINQ to SQL this new feature was added.
|
| VB301_02_01 - Local Type Inference |
|
|
In this video we'll talk about local type inference, also known as implicitly typed local variables. This introduces an easy way to create a variable without having to know the type ... but allowing the initializer to dictate the data type. When we work with LINQ, many times it may not be very clear what a given linq query is returning, and so local type inference allows us to say "we don't really care what it is, let VB figure it out." Microsoft suggests that you use this technique when working with LINQ to make development easier. Some authors I've read insist that you should use it as a temporary measure until you can figure out the exact return type ... one technique would be to set a break point and use the debugging tools to figure out what the actual type is. Whichever you decide is up to you, but the one thing to keep in mind is that this technique only works for the local scope. You can't return or reference a variable created with this technique outside of the scope of
|
| VB301_03_01 - Object Initializers |
|
|
In this next video in our VB 9 series we'll look at Object Initializers. These work similiarly to an initialized array, where we're able to set all or some of the properties of a newly created object in just one line of code. In some ways it's similar to a constructor that populates the properties of a newly instance of an object. However, unlike a constructor, you can pick and choose which properties to populate in any combination.
|
| VB301_04_01 - Anonymous Types |
|
|
In this video we'll look at another language enhancement in VB 9 and that is Anonymous Types. You might be familiar with anonymous methods in C# 2.0 which allowed you to create a function without a name ... to basically define the body of the function inline to another method call. Anonymous types are similiar ... you can think of them as "on the fly classes" ... or as you see here, un-named classes ... and the key to this is that the compiler "infers" or figures out what the type definition looks like based on the object initializer. You might wonder why in the world you would need such a thing, but they are used extensively when working with
LINQ, so we want to get our heads around them before we start looking at linq examples.
|
| VB301_05_01 - Extension Methods |
|
|
In this video we'll talk about extension methods which are simply methods -- usually helper methods that can be bolted on to the side of existing types / classes ... even if that type is sealed, meaning that it cannot be inherited from. In the past you may have had some helper methods that are intended for operation on certain types ... like a formatting method for example. This is similar in concept, but the implementation is cleaner and more elegant. The reason why Extension MEthods are important is because this is how LINQ's methods, like Select, Where, Sum, Count, are bolted on to the side of types that implement the IEnumerable interface, as well as others. So, Extension Methods are what makes LINQ's method syntax work.
|
| VB301_06_01 - Lambda Expressions |
|
|
In this video we talk about the last major topic before we plunge into LINQ and so we'll be talking about Lambda Expressions. If you are planning on using LINQ a lot, then you'll definitely be writing a lot of lambda expressions. What are they? Lambda Expressions are basically shorthand for anonymous delegates. For me, that statement was a bit hard to swallow. What does that really mean? So, in this video we'll start out with delegates, move to anonymous methods, then move to lambda expressions to show the progression of thought. But basically, you can think of an anonymous delegate as a little chunk of code that you can pass around as an object. Physically, it's a pointer to some function, but that sometimes is a bit nebulous. Said antoher way, Lambdas are short expressions that evaluate to some value. Let's stick with the idea of a little chunk of code that you can pass around. And the idea here is that you can stick this little block of code right into the parameter of a
|
| VB301_07_01 - Introduction to LINQ to Objects |
|
|
In this video we'll look at LINQ, specifically the most generic form of LINQ called LINQ to Objects. We'll cover the typical introductory material such as the why's and whatfor's, the different strains of LINQ in the wild, we'll look at the difference between the language integrated syntax versus the method syntax and then we'll spend the majority of our time look at small examples of LINQ in action.
|
| VB301_07_02 - LINQ Projection |
|
|
In this video we'll start diving deeper into both the LINQ to Objects
method syntax as well as the language integrated query syntax
shortcuts. We'll be talking about projection, and Projection
(from a LINQ perspective) is basically shaping or molding the data
that is returned from a LINQ query to include just the stuff you need
(as opposed to retrieving every field of the object.) You can use
this to: 1) Convert the data from one type to another (i.e.,
copy the value from a property in TypeA to a property in TypeB), or
2) Flatten the data from a hierarchy into a non-hierarchical form.
The new type could be something in in the framework,
a type you created, or an anonymous type.
|
| VB301_07_03 - LINQ Where Clause |
|
|
In this video we'll talk about the LINQ where clause,
which is a means of filtering a sequence to only
include values that meet some criteria, usually called
a predicate. We'll show how to create filtering conditions
for comparrisson, we'll demonstrate using multiple
where clauses using both the "and" operator and the
"or" operator.
|
| VB301_07_04 - LINQ From and Join |
|
|
In this video we'll look at the FROM and JOIN statements in LINQ. We'll look at how to retrieve both flattened and hierarchical
results, and how to create what we might basically consider both inner and outer joins if this were T-SQL. We'll also look at
the method syntax to accomplish these tasks as well.
|
| VB301_07_05 - LINQ Ordering and Grouping |
|
|
In this video, we'll look at basic ordering and grouping keywords and methods in LINQ.
|
| VB301_07_06 - LINQ Set Operations |
|
|
In this video we'll look at set operations in LINQ, and by set operations we're talking about some extension methods that allow us to merge two sequences together or filter one set given another set. We'll also look at the distinct keyword which works with a single sequence to filter out duplicates from a sequence.
|
| VB301_07_07 - LINQ Quantifiers |
|
|
In this video we've included pretty much every other linq extension method ... and we'll feature methods that can help you determine whether there are any items in the sequence at all, or at least, any items that meet a certain criteria, other methods that perform basic operations on the seuqnce ... that is the sum, the min, the max, the average and so on, methods that find the first or last occurance of an item in the sequence that meets a certain criteria and so on. We'll cover a lot, but honestly, there's no single method here that needs much in the way of detailed explanation ... I'm betting
that you've seen these sorts of operations before so it should be a fairly easy to digest video.
|
| VB301_08_01 - XML Literals |
|
|
In this video we'll look at the final new feature of Visual Basic 2008 and that is XML Literals. In the past, if you wanted to create
an XML snippet or document from code, you would have to use a rather cumbersome API to create documents, elements, attributes and so on. In Visual Basic 9.0, now you can create XML structures in code without using strings or API's. Substituting variables and even using to project a LINQ query using embedded code blocks, and finally XML axis properties and attributes.
|