Power Features in .NET 4Presented by Robert MacLean @rmaclean
Introduction
Level 200A tour: Lots of features – QUICKLYShow something for everyone!
Focus
• .NET 4 has over 100 new and improved features!– Too many for an hour or even a day.
• Our focus: BCL + FCL– Base class library– Framework class library
Problems
How do I know if this person is using x64 so I can optimise my code?I want to save files where my users can find them easily, like their My Documents or the Desktop?I need to loop over files in this directory… but I want it to be easy and fast!I would love to use bitwise flags in my code to set options!(I have lots of problems)
Demo
A bunch of smaller features in the core
Summary
Environment.Is64BitOperatingSystem Environment.Is64BitProcessEasy options to find out about the environment
Environment.GetFolderPathEnvironment.SpecialFolderEasy options to find those important paths
Enumerators for Files & FoldersFINALLY some generic love!
Enum FlagsMath made easy
Problem
I need smarter design time error detectionI need promises on what my methods will accept & return I need runtime error checking
Demo
Code Contracts in .NET 4
Summary
Code Contracts baked into the FrameworkTooling is a separate downloadGreat for design time help both in your own code and code you consume/expose to othersSandcastle can use this to augment your documentation
Problem
I need to improve application performanceMy application pulls lots of data from a database or webserviceSome of it is pretty static
10
Demo
Cache is king
Summary
Memory cache is awesomePer process onlyDesigned for you to build more cache stores, like a database or file systemGo and see AppFabric Caching
Problem
I need to build applications that are context awareI’m building an application that needs maps and location services
13
Demo
System.Device.Location
Summary
Awesome feature, especially with all these GPS enabled tabletsEasy to useCan use a software based GPS if hardware is not available
Session Summary
Small useful features• Is64BitOperatingSystem, Is64BitProcess,
GetFolderPath, SpecialFolder, File/Folder enumerators, FLAGS!
Better code with code contractsBetter performance thanks to memory cacheContext aware computing with System.Device.Location
Thank YOU!
Robert MacLeanwww.sadev.co.za (slides + demo scripts)@rmaclean