2. Agenda
Background
New Features in C# 5
Breaking Changes
Asynchronous Programming
Caller Info Attributes
Windows Runtime Support (Metro Style apps)
The Road Ahead
3. Background
Version Theme Year .NET Visual Studio
C # 1.0 Managed Code Jan 2002 1.0 VS .NET 2002
C # 2.0 Generics Nov 2005 2.0 VS 2005
C # 3.0 Language Integrated Nov 2007 3.5 VS 2008
Query
C # 4.0 Dynamic Apr 2010 4.0 VS 2010
C # 5.0 Asynchrony and Feb 2012 4.5 VS 2011
Windows Runtime
4. New Features in C# 5
Breaking Changes
Lambda expressions
LINQ expressions
Named arguments
Asynchronous Programming
Caller Info Attributes
Windows Runtime Support
5. Breaking Changes
Lambda expressions: Use of iteration variable of a foreach
statement in a lambda expression that’s contained in the body of the
loop
LINQ expressions: Use of iteration variable of a foreach statement
in a LINQ expression that’s contained in the body of the loop
Named arguments: Side effects from named and positional
arguments in a method call now occur in the correct order
8. Asynchronous Programming
public async Task<XElement> GetXmlAsync(string url)
{
var client = new HttpClient();
var response = await client.GetAsync(url);
var text = response.Content.ReadAsString();
return XElement.Parse(text);
}
public Task<XElement> GetXmlAsync(string url) {
var tcs = new TaskCompletionSource<XElement>();
var client = new HttpClient();
client.GetAsync(url).ContinueWith(task => {
var response = task.Result;
var text = response.Content.ReadAsString();
tcs.SetResult(XElement.Parse(text));
});
return tcs.Task;
}
10. Caller Info Attributes
More easily obtain information about the caller of a
method. By using Caller Info attributes, you can identify
the file path of the source code, the line number in the
source code, and the member name of the caller.
Demo: The use of Caller info attributes
How it reduces efforts and make code better
11. Windows Runtime Support
Windows Runtime: WinRT, is Microsoft's new programming
model that makes the backbone of the new Metro-style apps
(also known as Immersive) in Windows 8 operating system
.NET APIs for Metro style apps provides a subset of managed
types that you can use to create Metro style apps. This subset
of managed types is called the .NET APIs for Metro style apps.
Deep integration with the Windows Runtime - a C# project
can compiled into a WinMD file and then referenced from a
HTML/JavaScript project.
12. What is Metro Style
Metro is the whole design language behind Windows
Phone, and is a big part of the future of Microsoft
Using clean, crisp, clear information to get information
across as quickly and accurately as possible
Windows Metro style apps are designed for specific form
factors and leverage the power of the Windows operating
system.
13. Windows Metro style apps
Metro style apps are immersive and chromeless, filling the entire
screen so there are no distractions.
Metro style apps work together, making it easy to search, share, and
send content between them.
Metro style apps are tailored to your users' needs, to specific
devices, to touch interaction and hardware events, and to the new
Windows user experience in Windows 8 Consumer Preview.
14. Metro style design principles
Metro style design has a set of five guiding principles to help you make
the best choices when designing your app. These principles are the
foundation for building great Metro style apps.
Show pride in craftsmanship
Be fast and fluid
Be authentically digital
Do more with less
Win as one
15. What is excluded
The subset of managed types and members was designed
with a clear focus on Metro style app development. As a
result, it omits the following:
Types and members that are not applicable to developing Metro
style apps (such as console and ASP.NET types).
Obsolete and legacy types.
Types that overlap with Windows Runtime types.
Types and members that wrap operating system functionality (such
as System.Diagnostics.EventLog and performance counters).
Members that cause confusion (such as the Close method on I/O
types).
17. The Road Ahead
Compiler as a service
The Roslyn Project
CTP of Visual Studio Roslyn in mid October 2011
C# interactive window
“Paste as VB” and “Paste as C#”
18. Thanks to You All
Let us grow together
Keep in touch:
Blog: praveenprajapati.wordpress.com
Notas del editor
When users are connected to the internet, their apps show them the latest content so that they can stay up to date. With a connected account, users can download apps and use them on any Windows device.