Upgrade to Pro — share decks privately, control downloads, hide ads and more …

.NET Framework 4 ve Visual Studio 2010 Yenilikleri

.NET Framework 4 ve Visual Studio 2010 Yenilikleri

Daron Yondem

March 25, 2010
Tweet

More Decks by Daron Yondem

Other Decks in Programming

Transcript

  1. .NET Framework 4 ve Visual Studio 2010 Yenilikleri Daron Yöndem

    Microsoft Regional Director Silverlight MVP
  2. C# 4.0 • Dynamic typing • Generic variance • Named

    arguments • Optional parameters • COM interop enhancements
  3. The DLR on the CLR • Common Language Runtime –

    CLR: – Common platform for static languages – Facilitates great interop • Dynamic Language Runtime – DLR: – Common platform for dynamic languages – Facilitates great interop
  4. Named arguments • Because Foo(37, 28, 93, 18, true, true,

    false) is frankly enigmatic • Intended for use in demystifying calls to libraries outside your control, not to excuse designing bad and obscure APIs yourself
  5. Optional parameters • Were evil in 2002 – Versioning considerations

    • Time heals all wounds – Except those inflicted by DCOM security • Uses OptionalAttribute and DefaultParameterValueAttribute – Does not create an overload – Compatible with Visual Basic
  6. COM interop enhancements • Named and optional arguments support COM

    APIs that depended heavily on them • “No PIA” – Merges COM interop type definitions into the calling assembly so you don’t need to deploy a PIA – Runtime magic to identify COM types from multiple assemblies • Omitting stupid “ref missing” arguments
  7. Visual Basic Gelişimi Visual Basic 1.0-3.0 Visual Basic 4.0-6.0 Visual

    Basic 7.0-9.0 Visual Basic 10.0 Visual Basic 11.0+
  8. Dynamic - Static Dynamic Diller Simple and succinct Implicitly typed

    Meta- programming No compilation Static Diller Robust Performant Intelligent tools Better scaling
  9. Auto-implemented Properties Property FirstName As String Property LastName As String

    Initializers: Property ID As Integer = -1 Property Suppliers As New List(Of Supplier)
  10. Collection Initializers Dim x As New List(Of Integer) From {1,

    2, 3} Dim list As New Dictionary(Of Integer, String) From {{1, “Bart”}, {2, “Lisa”}, {3, “Homer”}} Array Literals: Dim a = {1, 2, 3} 'infers Integer() Dim b = {1, 2, 3.5} 'infers Double()
  11. Statement Lambdas Dim items = {1, 2, 3, 4, 5}

    Array.ForEach(items, Sub(n) Console.WriteLine(n)) Array.ForEach(items, Sub(n) If n Mod 2 = 0 Then Console.WriteLine(n) End Sub) 'Count the number of even items in the array Dim total = items.Count(Function(n) Return (n Mod 2 = 0) End Function)
  12. Implicit Line Continuation <Attribute()> Function Go( ByVal x As Integer,

    ByVal y As Integer ) Dim query = From n In { 123, 456, } Order By n Select n + x
  13. Python Binder Ruby Binder COM Binder JavaScri pt Binder Object

    Binder .NET Dynamic Programming Dynamic Language Runtime Expression Trees Dynamic Dispatch Call Site Caching IronPython IronRuby C# VB.NET Others…
  14. Generic Variance Dim apples As IEnumerable(Of Apple) = New List(Of

    Apple) 'Covariance (Apple inherits from Fruit) Dim fruits As IEnumerable(Of Fruit) = apples 'Contravariance - Func(Of In T, Out R) Dim predicate As Func(Of Fruit, Boolean) = Function(f) f.Color = "Red" apples.Where(predicate)
  15. Threading/Concurrency -> Parallelism On Single Core Machine – Don’t block

    the UI • Thread Affinity – Async Operations – Synchronization Issues On Multi-core Machine – As above... – ... plus Improve Actual Performance – ... plus create new user experiences