|
|
|
|
Advanced C# 2.0 / .NET 2.0 Patterns and Practices BootCamp (C# 2.0, VS2005, .NET 2.0)
|
|
|
|
Our Advanced C# BootCamp is for software developers who:
- Have a minimum of at least 1 year of experience programming .NET Framework 1.x in C#1.0 with VS.NET 2003, or
- Previously attended either our classic .NET BootCamp / C# or its successor the C# 2.0 / .NET 2.0 BootCamp are ready to learn intermediate and advanced techniques with C# 2.0, .NET 2.0, VS2005 and VS Team System Developer Edition.
Sorry, there'll be no hand-holding if you don't meet these qualifications! If that's the case, you should instead attend our C# 2.0 / .NET 2.0 BootCamp. |
|
You should already have 1+ years experience programming the .NET Framework 1.x using C# 1.0 and VS.NET 2003 before attending this course.
Alternatively, if you've previously attended our classic .NET BootCamp or the .NET 2.0 BootCamp, you also qualify: this course is the designated follow-on for .NET BootCamp or .NET 2.0 BootCamp graduates who want to extend their knowledge of .NET and C#. (This course overlaps with no more than 10% of the .NET 2.0 BootCamp material.)
|
- Why loose coupling means never having to say you're sorry
- How to build Generic types in C# 2.0
- When to create static classes in C# 2.0
- How to refactor types across assemblies with [InternalsVisibleTo]
- What New Features were added to the FW 2.0 Base Class Libraries (50% more classes and methods)
- What Anonymous Methods in C# 2.0 are -- and how to use them.
- A simpler way of wiring up events and event-handlers
- How to use the new Reference Alias feature in C# 2.0
- How to create Generic Methods in C# 2.0
- Why Delegate CoVariance and ContraVariance C# 2.0 aren't a big deal (they should have worked in C# 1.0!)
- How to understand the Patterns built-into C# 1.0 work: lock, foreach, using, as/is and unsafe
- What new patterns are built into C# 2.0: yield, delegate
- How C# 2.0 Custom iterators and anonymous methods are the basis for the Sequencing libraries and lambda expressions in C# 3.0
- Why static cast is an anti-Pattern
- Best Practice: using Implicit vs. Explicit interface implementation
- Using partial to segregate implementations
- Best Practice: using Interfaces or Abstract Base Classes
- How Generics differ from C++ Templates
- How Generics will improve the performance of handling both Value Types (structs) and Reference Types (classes)
- The value of creating and using Generic Interfaces and Delegates
- The built-in Generic Delegates in Framework 2.0 -- and how to leverage them for creating thin layers of abstraction.
- How the CLR specializes Value Types differently from Reference Types
- What Generic Constraints are
- When to use Constraints in defining your own Generic Types
- How to use Reflection to create new Generic Types dynamically
- How to serialize Generic types (and when you can't)
- How to expose Generic types via .NET Remoting
- When to derive from Generic types -- both with or without a type argument -- and why
- Why you should avoid using ArrayList in the future
- Why you should avoid using System.Object in the future
- What parts of the Base Class Libraries are potential bottlenecks
- The value of type-safe collections
- The difficulties of creating type-safe collections in .NET 1.x
- How to create type-safe collections in .NET 2.0 with Generic types
- How the new Collection interfaces in .NET 2.0 differ from those .NET 1.1
- How to use the new Collection classes in .NET 2.0
- When to use List<T> vs. Collection<T> vs. ReadOnlyCollection<T>
- How to leverage the new Generic Delegates with Array.ForEach<T>, Array.TrueForAll<T>, List<T>.ForEach and others
- How to write your own Sequencing libraries to leverage Custom Iterators and Anonymous methods
- What Nullable Value Types are
- The differences between struct Nullable<T> and class Nullable
- How to specialize Nullable types in C#
- How to use Nullable Value Types
- Minor deficiencies in Nullable<T>
- Casting Nullable Types
- The value of custom iterators
- The difficulties of creating custom iterators in .NET 1.x
- The fast, powerful way to create custom iterators with C# 2.0
- How to pipeline IEnumerator<T> from one iterator to another
- How to create iterators that filter their results
- How to create iterators that order their results
- How to create recursive iterators -- and when to do so
- Why iterators aren't continuations and don't use multi-threading
- When your iterator should return IEnumerator<T> vs. IEnumerable<T>
- When you should use yield return vs. yield break
- When you should and shouldn't create multiple AppDomains
- How to implement the Hot Update Pattern with AppDomains
- Why "strong naming" doesn't prevent tampering
- How to leverage the CLR APIs from C#
- Best Practices for Naming Conventions
- Best Practices for creating Value Types
- Best Practices for implementing ICloneable -- and why ICloneable<T> is better
- The difference between ReferenceEquals vs. Equals
- When and how to implement Comparers in C# 2.0
- When and how to use static constructors
- How AppDomains scope the lifetime of static members
- How to leverage the .NET Component Pattern
- How Delegates and Events implement the Observer Design Pattern
- How to create Limited Subscription Observers
- How to use the Bridge Pattern to expose internal Observed Objects
- How to implement Weak-Reference Events
- How to leverage the BackGroundWorker Component
- How to use Asynchronous Delegates
- How to implement the "Fire and Forget" Pattern with Async Delegates
- How to implement the "Notify Me" Pattern with Async Delegates
- How to implement the "Don't Call Me, I'll Call You" Pattern with Async Delegates
- When to use the AsyncOperation class
- How to create Mult-threaded WinForms
- How to create async Web Pages
- How to implement Finalize-Dispose in a thread-safe fashion
|
|
C# 2.0 is an evolution of C# 1.0, which shipped with .NET 1.0 in February, 2002. It extends the C# langauge in several major ways and few minor ones:
Major extensions to C# in 2.0:
- Support for Generic classes, structs, interfaces, delegates and methods that give you major re-usability options over ordinary inheritance and containment, and allow for even more loose-coupling arrangements than previously available.
- Custom iterators: classes that can implement IEnumerator<T> (and its non-Generic counterpart) via methods that return IEnumerable<T>, allowing you to easily create methods for sorting, searching, filtering and otherwise processing groups of objects, be they in collections or not.
- Anonymous methods: methods defined an used in the same context, inside of an existing method, letting you create methods that are small, light-weight, easy-to-maintain building blocks.
Minor extensions to C# in 2.0:
- More flexibility in using delegate methods with derivative return values.
- More flexibility in using delegate methods with base class parameter types.
-
static
classes: classes that are sealed, abstract and only allow static members
-
partial
types: interfaces, classes, structs and enums whose definition extends across source boundaries of a single assembly/project.
- The global namespace qualifier operator, ::, for identifying types in the outer-most namespaces.
- Reference aliases, as a means of assigning further identifying information to types from a particular assembly (via the :: operator)
- The use of differing access specifiers on the getter/setter of a property (e.g., for a public getter but an internal setter).
Non-extensions to C#:
- "Friend assemblies": often documented as a C# feature, this a .NET Framework feature that has nothing to do with the C# language.
In my opinion, you can make the case that these extensions simultaneously do 2 things:
- Make C# even more productive than it was in C# 1.0.
- Position C# for the new features -- in the form of lambda expressions, sequence-processing and extension methods -- being added in C# 3.0.
|
|
.NET 2.0 is an order-of-magnitude extension to .NET 1.1 in the way of 8500 public classes (over the 5300 in 1.1), 84,000 public methods (vs. 54,000 in 1.1) of which 50,000 are not property/event accesor methods (vs. 36,000 which weren't in .NET 1.1).
It adds a new CLR with a smaller working set, more efficient execution in many areas (such as delegate invocation), support for runtime JIT of Generic types into concrete types, and enhanced security features.
.NET 2.0 adds functionality over .NET 1.1 in the following areas:
- String management
- Data collection
- Database access - typed DataSets come out of the closet for everyday use.
- File I/O - easier-to-use file read/write for simple scenarios.
- Encryption
- Diagnostics/Debugging
- Project Build Management
- Code/assembly generation
- Collections - full-scale support for Generics at the type, interface and metadata level.
- Component Development
- Configuration - full .config read/write, a more powerful Configuration object, plus user/application settings.
- Deployment/Installation
- Networking/sockets - richer objects for networking.
- Security/Cryptography - more information in Security exceptions, improved cryptography APIs.
- Threading - across-the-board improvements in the Thread class, asynch threading and easier-to-use worker controls and components.
- Transactions - full-scale, multi-machine transactions that obviate the need for Enterprise Services.
- Web Development - an overhaul of the Web Forms model and huge number of new services and controls.
- WinForms - improved menu/toolbar components and cleaned up eventing, plus a number of new controls.
There are hundreds of tiny improvements that were added in this release that don't fit neatly in any category.
Among the few areas left untouched by .NET 2.0 over 1.1 are:
- Web Services and .NET Remoting (both superceded by the release of WCF in .NET 3.0 -- which is really .NET 2.5)
|
|
Why Patterns and Practices?
|
|
|
|
|
Overview of Key Course Modules
|
|
|
|
|
Introduction to .NET 2.0
Leveraging C# 2.0
C# 2.0 and Generics
Applied Generics: Implementing Type-Safe Managed Collections
Applied Generics: Nullable Value Types
C# 2.0: Custom Iterators
Patterns and Practices when Writing Managed Code
Best Practices for C# Type and Member Design
Patterns with Delegates and Events
Best Practices for Asynchronicity and Threading
Best Practices for Writing Secure Managed Code
Best Practice: Managed C++/CLI As an InterOp Tool for C# Developers
Leveraging New Features in the .NET 2.0 Base Class Libraries
Investigating Visual Studio 2005 Professional
VS2005 Pro Debugging
Leveraging ADO.NET 2.0
Windows Forms 2.0
ASP.NET Web Forms 2.0
Patterns and Practices for Building Distributed Managed Applications
Additional and Alternative Libraries and Tools
Visual Studio Team System: Developer Edition
A look into the Future
|
|
1. Introduction to .NET 2.0
- Major Evolution, not Revolution
- .NET and the N-tiered Pattern
- Requirements
- Thin-client, Thick-Client and Server requirements
- Developer box requirement
- Overview: what’s New in the CLR?
- Generics
- Changes to the GAC
- Refactoring Assemblies, “Friend Assemblies” and [InternalsVisibleTo]
- Tweaking the GC with AddMemoryPressure/RemoveMemoryPressure
- Finalizers in MC++
- Security Demands
- CLR Hosting
- Threading and the Debugger
- Overview: what’s New in the Base Class Libraries?
- Overview: what’s new in C# 2.0?
- Overview: what’s new in VS2005?
- Tools Above and Beyond VS2005
2. Leveraging C# 2.0
- Overview: What’s New in C# 2.0?
- Defining property accessors with differing access levels
- Creating type definitions that span source file boundaries: Partial Types
- Creating utility classes: static classes
- Defining headless methods inside existing methods: Anonymous Methods
- Using a simpler delegate/event-wiring syntax: Delegate Inference
- The namespace qualifier operator
- The global namespace
- Reference aliases
- Delegate CoVariance and ContraVariance
3. C# 2.0 and Generics
- What are Generics – and why bother with them?
- How Generics differ from C++ Templates
- Performance and Generic Types
- Defining and Using Generic Types (classes, structs, interfaces, and delegates)
- Default Values
- CLR Specialization of Generic Types
- Value Types
- Reference Types
- Generics and variable-parameter methods
- When and how to use Constraints
- Why Constraints?
- Forms of Constraints
- Reflection and Generic Types: New services in System.Type
- Serializing Generic Types
- Remoting Generic Types
- Best Practices
- Deriving from Generic Types, with/without specific type argument
- Deprecating your use of ArrayList
- Deprecating your use of System.Object
- Potential Bottlenecks and PitFalls in the BCL
4. Applied Generics: Implementing Type-Safe Managed Collections
- Principles of Type-Safe Collections
- Understanding the new Collection Interfaces
- Why Int32 and other primitives implement IComparable<T>
- Understanding the new Collection Classes
- Why ArrayList should be [Obsolete] and is now a worst Practice
- Creating type-safe collections with Generics
- List<T> vs. Collection<T> vs. ReadOnlyCollection<T>
- Using Array.ForEach<T> and Array.TrueForAll<T>
5. Applied Generics: Nullable Value Types
- Why create types that can be null ?
- struct Nullable<T>
- Specializing Nullable<T> in C#
- The Nullable Ternary Operator
- The Nullable<bool> operators
- class Nullable
- Casting Nullable Types
6. C# 2.0: Custom Iterators
- What are Custom Iterators and why are they important?
- Iterators the old (hard) way (C# 1.0)
- Iterators the new (easy) way (C# 2.0)
- Simple Iterators
- Forward Iterators
- Backward Iterators
- Iterators with runtime criteria
- Iterator Best Practices
- When to use yield return vs. yield break
- When to return IEnumerator vs. IEnumerator<T>
- When to return IEnumerable vs. IEnumerable<T>
- Applied Iterators
- Real-world problems
- Performance: compiler-generated Iterators vs. hand-coded ones
- Iterating over a tree- or directory-structure, recursive Iterators
- Iterators aren’t continuations
- How foreach works with Iterators
7. Patterns and Practices when Writing Managed Code
- Targeting a Framework version
- Obtaining Process Information
- Using AppDomain Services and Multiple AppDomains
- The HotUpdate Pattern
- Implementing version-tolerant Serialization
- The “strong-name will prevent tampering” myth
- try-catch Differences in .NET 2.0
- Leveraging the CLR APIs
- Enumerating Managed Processes and AppDomains
- Patterns and Practices in C#
- Using lock to implement a Synchronization Pattern
- using for client-side early Disposal (and why using is an Anti-Practice)
- Using foreach to implement the Iterator Design Pattern
- Best Practices for Casting: as/is
- Traditional static cast as an anti-practice
- unsafe and pointer usage in C# as an Anti-Practice
- Best Practices for Interface Implementation: Implicit or Explicit?
- Using partial to segregate implementations
- Best Practices for Abstraction: Interfaces or Abstract Base Classes?
- Creating Plug-Ins: The Pluggable Type Pattern
8. Best Practices for C# Type and Member Design
- Review: Characteristics of the Kinds of Types in .NET
- Naming Conventions
- Microsoft’s recommendations
- RHS’ recommendations
- Establishing your own criteria
- When to create custom Value Types – and when not to
- When to implement ICloneable
- ReferenceEquals vs. Equals
- Implementing Comparers
- Using static constructors
- AppDomain Scoping and lifetime of static members
- The .NET Component Pattern
9. Patterns with Delegates and Events
- Review
- The Observer Pattern
- The Delegate/MulticastDelegate Myth
- Events are Delegates used as Properties
- The Compiler-generated add_/remove_ methods
- Variations on the Observer Pattern: overriding the Compiler-generated Add/Remove methods and when to do so
- The Limited Subscription Pattern
- The Controlled Subscriber Type Pattern
- The Synchronized Subscriber Pattern
- The Event Bridge Pattern
- The Weak-Reference Event Pattern
10. Best Practices for Asynchronicity and Threading
- Logical vs. Physical Thread IDs
- Review: The Asynchronous Pattern
- The Background Worker Component
- In Windows Forms, Web Forms, and Web Services
- Asynchronous Delegates
- The “Fire and Forget” Pattern
- IAsyncResult and AsyncCallBack
- The “Notify Me” Pattern
- The “I’ll Call You” Pattern
- Practices and Anti-Practices
- Asynchronous Events and the Event-based Async Pattern
- Threads and WinForms: Invoke vs. BeginInvoke
- WinForm WrongThreadException
- Threading and WebForms: Async Web pages
- Implementing a Thread-Safe Finalize-Dispose Pattern
11. Best Practices for Writing Secure Managed Code
- Understanding Code Access Security
- When to apply Strong-Names
- Don’t overuse CodeAccessPermission.Assert
- Best Practices for using Security Demands
- Best Practices when writing day-to-day Managed Code
- Best Practices to check before releasing your application
- Using FxCop or VSTS to flag Security Holes
12. Best Practice: Managed C++/CLI As an InterOp Tool for C# Developers
- [DLLImport] and TLBImp as Anti-practices
- When to use MC++, when not to, and
- The new MC++/CLI Syntax
- Finalizers/Destructors/Dispose and Finalization issues in MC++
- The new MC++ compilation options and when to use them
- /clr
- /clr:pure
- /clr:safe
- /clr:oldsyntax
- Building Mixed-Mode Assemblies containing Native and Managed C++
- How to create effective Interop Object Adapters with MC++
13. Leveraging New Features in the .NET 2.0 Base Class Libraries
- Overview of the 2.0 BCL
- Deprecated APIs
- Deprecation policy
- [Obsolete]
- Breaking Changes at DesignTime and Runtime
- System
- TryParse
- DateTime
- Console
- Environment
- String
- System.ComponentModel
- How DataBinding changes in .NET 2.0
- Review: the DataBind Pattern
- New Classes and interfaces
- System.Configuration
- Using the new Configuration features
- Reading and writing configuration settings
- Creating .config files for .DLL assemblies
- Creating Validators
- Catching Configuration changes
- System.Diagnostics
- New Trace Listeners: easier ways to leverage Logging/Tracing
- System.Globalization
- System.IO
- The File.ReadAll* / File.WriteAll* Methods
- Directory.GetFiles
- System.IO.Ports
- System.Net
- System.Net.Mail – adding email to your applications
- System.Net.NetworkInformation – tools for adding ping, network info and IP manipulation to your applications
- System.Resources.Tools
- System.Runtime.CompilerServices
- System.Security
- System.Text.RegularExpressions
- System.Threading
- System.Xml – investigating the new XML classes vs. the deprecated older ones
14. Investigating Visual Studio 2005 Professional
- Overview: What’s New in VS2005 Pro
- Improved UI
- Importing/Exporting Settings
- Startup Project Changes
- Project and Solution File changes
- Creating Custom Project/Solution Templates
- Referencing EXE Assemblies – when and when not to
- Intellisense features
- Auto-injecting using directives
- Code Snippets and rolling-your-own Custom Snippets
- Refactoring Features
- vs. Martin Fowler’s “Refactoring”
- Renaming Files, Types and Members
- Project Properties and Assembly Attributes
- Program Properties and Settings
15. VS2005 Pro Debugging
- Debugging Managed Code
- Intellisense in the Watch Window
- Expanded DataTips
- Debugger Visualizers
- [DebuggerNonUserCode]
- Setting up and using Remote Debugging
- Debugging without an Administrative Login
16. Leveraging ADO.NET 2.0
- Provider Factories and Provider operations
- Async database operations
- Multiple Active Results Sets and Batching
- Working with User-defined data types
- Server Enumeration and Schema Discovery
- .NET 2.0 Transactions
- Typed DataSets come out of the Closet
- What happened to DataTable/DataSet/Adapter?
- Generating, using and re-generating Typed DataSets
- Inside the generated code
- .NET Object-Relational Mapping (ORM) Solutions: nHibernate
17. Windows Forms 2.0
- How project sources are now managed
- WinForms 2.0: MenuStrip and ToolStrip
- Changes to MDI applications
- MergeOrder vs. MergeIndex
- WinForms 2.0 Controls
- Web Browser control
- Masked Edit control
- TableLayout and FlowLayout Controls
- SplitContainer Control
- Using the AutoComplete Property
- DataBinding and DataGridView Controls
- Sound Player
- ClickOnce and Manifest-based Activation
- How do you know you’re in a ClickOnce application?
- Adding a Splash Window to a Form
- Application Settings
- Adding a Navigation View Window
- Implementing WinForms Custom Controls
- Using SmartTags
18. ASP.NET Web Forms 2.0
- 2.0 Master Pages and Themes, Web Parts
- 1.0 Controls, 2.0 Controls, Custom Controls
- State Management: ViewState, SessionState and ApplicationState
- Adding client-side validation code
- Site Navigation and User-customization
- ViewState, SessionState and ApplicationState
- DataBinding and the 2.0 Provider Model, DataGrid and DataList
- 2.0 Built-in Configuration
- 2.0 Membership, Roles, Personalization
- Authentication and Authorization
- Peformance: Pre-compiling and caching
- Deployment and Installation
- Deployment with IIS
- Web Site Administration and targeting a particular Framework version
19. Patterns and Practices for Building Distributed Managed Applications
- Patterns for Middle-Tier Code
- ASP.NET Web Services 2.0
- Extensions to the Async Pattern in Client-side proxy code
- Securing Web Services
- .NET Remoting 2.0
- Changes to ChannelServices
- Authentication/ Encryption in Remoting 2.0
- Using a Windows Service to Build an all-purpose Remoting Server LaunchPad
- Hosting under IIS
- Using the new IpcChannel
- Remoting .NET Events
- Invoking and Firing on Remoted Forms
- Transmitting Assemblies over-the-wire
- Building a Custom Remoting Proxy
- Deprecating EnterpriseServices
- Replacing Transaction support with System.Transactions
- Replacing JITA
- Replacing Object Pooling
- Preparing for Windows Communication Foundation (Indigo)
20. Additional and Alternative Libraries and Tools
- Enterprise Library 2.0
- nHibernate
- Obfuscators and DRM Tools
- Real No-Touch Deployment
- Collection Libraries
- Roll-Your-Own: Creating Add-Ins for VS2005
21. Visual Studio Team System: Developer Edition
- Overview of VSTS and Team Foundation Server
- Overview of Developer Edition
- A Practical Testing Philosophy: Test the Heck out of it!
- Unit Testing
- Code Coverage Analysis
- Dynamic code analysis
- Static code analysis
- Profiling
- Detecting Boxing/Unboxing bottlenecks
- Detecting memory and GC issues
22. A look into the Future
- Introducing C# 3.0
- Simplifying the declaration syntax of local variables: Implicitly Typed Locals
- Add new methods to an existing type without modifying the type or derivation: Extension Methods
- C# 2.0 Anonymous Methods with simpler syntax, more expressive power – and results: Lambda Expressions
- More elegant object initialization using named properties: Object Initializers
- Inferring object typing from object initializers to create dynamic types: Anonymous Types
- Inferring array types from an array initializer: Implicitly Typed Arrays
- Building relational and hierarchical queries similar to those in SQL and XQuery: Query Expressions
- Building entire trees of lambda expressions: Expression Trees
- Introducing Windows Communication Foundation (WCF) (formerly known as “Indigo”)
- Introduction to WCF: Microsoft's next-generation programming platform and runtime system for building, configuring and deploying network-distributed services
- How WCF uses a single programming model to:
- Supplant previous distributed systems technologies such as ASP.NET Web Services, .NET Remoting, DCOM, MSMQ, Enterprise Services (COM+), etc.
- Provide cross-platform integration and loose-coupling of services
- Support durable, scalable queued messaging
- Offer integrated transactions
- Allows elegant communications with Managed objects
*Outline subject to change without notice.
|
|
|
|