Video Tutorial Library:

C# 301 - C# 3.0 Language Enhancements

This series highlights the changes to C# in version 3.0 (released with
Visual Studio 2008, all versions).  Without a doubt, C# 3.0 will be long
remembered as a turning point in the language with the introduction of
LINQ and all its variants.  In this series we look at each major
feature as we build towards showing how they fit into the LINQ story.
We'll finish with a look towards the Language Integrated Query syntax
and use that as a basis for other series that utilize the basics of
LINQ as a unified data access strategy for SQL Server (LINQ to SQL),
XML (LINQ to XML), Datasets (LINQ to ADO.NET) and the new Entity
Framework (LINQ to Entities).

The following videos are available for this series:

CS301_01_01 - Auto Implemented Properties
Auto Implemented Properties provide a short-cut to creating the verbose getter and setter methods, as well as the accompanying private fields used when creating classes. Also discussed are the prop and propg code snippets to even further reduce the amount of typing required to create a class' properties.
CS301_02_01 - Local Type Inference (var keyword)
In this video we'll talk about local type inference, also known as implicitly typed local variables. This introduces the var keyword to C# 3.0, and it is used basically as an easy way to create a variable without having to know the type. When we work with LINQ, many times it may not be very clear what a given linq query is returning, and so the var keyword allows us to say "we don't really care what it is, let C# figure it out." Now, Microsoft suggests that you use the var keyword 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 the var keyword only works for the local scope. You can't return or reference a variable created with var outside of the scope of a local method.
CS301_03_01 - Object and Collection Initializers
In this next video in our C# 3.0 series we'll look at Object and Collection Initializers. These work similiarly to an initialized array, where we're able to set the properties of a newly created object or multiple instances of new objects in a new collection in essentially one line of code. Let's start with object initializers ... In some ways it's similar to a constructor that populates the properties of a newly instance of an object. However, unline a constructor, you can pick and choose which properties to populate in any combination.
CS301_04_01 - Anonymous Types
In this video we'll look at another language enhancement in C# 3.0 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 "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.
CS301_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.
CS301_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
CS301_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.
CS301_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 Type A to a property in Type B), 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. We'll start with simply selecting an entire sequence from a collection. Then we'll start selecting single fields or new instances of a named type, and finally select data into anonymous types.
CS301_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.
CS301_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 over the following C# keywords: join - on - equals and into ... and we'll cover the following extension methods: SelectMany(), Join() and GroupJoin().
CS301_07_05 - LINQ Ordering and Grouping
In this video, we'll look at basic ordering and grouping keywords and methods in LINQ. We'll cover the following C# keywords: orderby, descending, group by ... as well as the following extension methods: OrderBy(), ThenBy(), OrderByDescending(), ThenByDescending() and GroupBy().
CS301_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. We'll cover: Concat(), Union(), Intersect(), Except() and Distinct().
CS301_07_07 - LINQ Quantifiers
In this video we've included pretty much every other linq extension method ... featuring 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: Any(), All(), Contains(), Count(), Sum(), Min(), Max(), Average(), First(), FirstOrDefault(), Last(), LastOrDefault(), Single(), SingleOrDefault() and Aggregate().

Our Membership Options

  • Easy to understand, concise VB.NET, C#, and ASP.NET tutorial videos
  • 500+ Video tutorials
  • Begin downloading instantly
  • Memberships starting at $69.95
  • Lifetime Access for only $199.95

Get Free Videos via Email

Sign up for our newsletter and receive links to free videos monthly.

Subscribe

We don't rent/sell/or commit other evil deeds with your email address. See our Privacy Policy.