201209 tech days .net 4.5 核心功能及綜覽
-
Upload
meng-ru-tsai -
Category
Technology
-
view
824 -
download
0
description
Transcript of 201209 tech days .net 4.5 核心功能及綜覽
蔡孟儒
台灣微軟技術暨平台推廣處
技術推廣協理
WHY Change? 在趨勢的演進中拉距
.NET 簡史以及相容性
.NET 2.0 .NET 3.0
.NET 1.1
.NET 1.0
2002 2003 2005 2008 2010 2012
橫線上的較新版本皆為in-place updates (就地更新)
.NET 3.5
.NET 4.5 .NET 4
.NET 4.5 於安裝時取代
.NET 4 (或升級Windows 8時) .NET 4 仍可在Visual Studio 2012 中設為目標Framework
Application Compatibility in the .NET Framework 4.5
http://msdn.microsoft.com/en-us/library/hh367887(v=VS.110).aspx
Migration Guide to the .NET Framework 4.5:
http://msdn.microsoft.com/en-us/library/ff657133(v=VS.110).aspx
http://msdn.microsoft.com/en-us/library/hh266747(VS.110).aspx
.NET 4.5 重要特色 .NET for Windows 市集應用程式
Desktop
C#版的WinRT App…
ECMA 335
DllImport "avicap32.dll" "capCreateCaptureWindow"static extern int string int int int int int int int
DllImport "avicap32.dll"static extern bool int MarshalAs UnmanagedType ref string int MarshalAs UnmanagedType ref string int
// more and more of the same
using Windows.Media.Capture; var new CameraCaptureUI
new Size
var await CameraCaptureUIMode
if
var new BitmapImage
await FileAccessMode
http://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-applications
Async & Await
var
var
.NET 以往處理非同步運算的方法
除了好寫、易讀,debug更容易 private void UseData(String filePath) { Byte[] buff = new Byte[BuffSize]; using (Stream str = File.OpenRead(filePath)) { IAsyncResult asRes = str.BeginRead(buff, 0, buff.Length, (ar) => { if (!ar.CompletedSynchronously) { Int32 len = str.EndRead(ar); ProcessData(buff, len); } }, state: null); if (asRes.CompletedSynchronously) { Int32 lenRes = str.EndRead(asRes); ProcessData(buff, lenRes); } } }
private async Task UseDataAsync(String filePath) { Byte[] buff = new Byte[BuffSize]; using (Stream str = File.OpenRead(filePath)) { Int32 lenRes = await str.ReadAsync(buff, 0, buff.Length); ProcessData(buff, lenRes); } }
http://blogs.msdn.com/b/windows
appdev/archive/2012/04/24/diving
-deep-with-winrt-and-await.aspx
ReadAsyncWriteAsync CopyToAsync FlushAsyncReadLineAsync ReadToEndAsync
Stream FileStreamMemoryStream TextReader TextWriter
http://msdn.microsoft.com/en-us/library/kztecsys
To handle the exception in C# or Visual Basic, you use a try/catch block
just as you do with synchronous code today:
var title;
var feedUri = new Uri("http://www.devhawk.com/rss.xml");
var client = new
Windows.Web.Syndication.SyndicationClient();
try
{
var feed = await client.RetrieveFeedAsync(feedUri);
title = feed.Title.Text;
}
catch (Exception ex)
{
// An exception occurred from the async operation
}
Portable Class Library
http://msdn.microsoft.com/library/gg597391(v=vs.110).aspx
ONE ASP.NET – MVC 4, Web API, Bundling & Minification
ASP.NET more pluggable, more open, more fun
Scott Hanselman
Web API
Bundling & Minification
MPGO big wins in CLR garbage
Windows Store App 大募集 活動期間: 2012/09/20 ~ 2012/11/09
http://aka.ms/Win8AppFest
年費:
- 公司帳戶:NT$2,840
- 個人帳戶:NT$1,420
12個月免費:
- MSDN 訂戶
- BizSpark 計劃: 新創資訊公司
- DreamSpark 計劃: 老師、學生
http://msdn.microsoft.com/en-us/library/ms171868(v=vs.110)
http://code.msdn.microsoft.com/Whats-New-in-the-NET-e8d7545c