This lecture focuses on some of the newer additions to the C# language, e.g., LINQ, Extension Methods, and delegate shortcuts.
Web Resourses:
C# Tutorials
Lecture Specifics:
- The Syllabus describes topics to be covered, reading material for you to digest before coming to class, and due dates for the assigned projects.
-
Projects:
-
Q & A Threads:We will be using piazza.com to host Question and Answer threads. This will work to give quick answers to fairly short questions.
It will not work to discuss complex questions about your coding problems or debugging.
For that you will need to ask questions during the Synchronous lectures. -
C# Examples:
Delegates:
-
Delegate Structure Diagram
-
Delegates Demos
Illustrates classic definition and use of delegates. Newer ways are syntactically cleaner -see below. -
Various ways to declare and use delegates
Newer syntax is less verbose - I use it a lot now. -
Navigate Directory Trees
Recursive walk of a directory tree. Isn't reusable as file and directory processing is part of the walk code. -
Navigate with Delegates
Here the directory tree walker is made reusable by using delegates to call into client code. -
Using Delegates - MSDN link
Lambdas:
-
Lambda capture
Fairly simple example of lambda definition and use. -
Lambda Demos
Contains three demos:
- LambdaDemo: illustrates delegate and lambda structures using reflection
- MoreLambdas: Discloses behavior of lambda's variable capture
- PredicateLambda: Shows one way to build query processing for Project #2
Other Demos:
-
Delegate Structure Diagram
-
More C# Code Examples and Tutorials:
-
LINQ and related topics:
We will discuss these in the XML lecture. Look ahead if you wish. IQueryable<T> members - MSDN link
IEnumerable<T> members - MSDN link
Extension Methods - used by LINQ LINQ Presentation, pptx
LINQ Query Examples from presentation Scott Guthrie's LINQ blogs
LINQ Queries on Collections
LINQ to XML
Create XML with XDocument
LINQ to SQL
LINQ Bindings -
Lecture Take-away:
Most important topics are:- Delegates
- Lambdas