Presentation is loading. Please wait.

Presentation is loading. Please wait.

Eric Vogel Software Developer A.J. Boggs & Company.

Similar presentations


Presentation on theme: "Eric Vogel Software Developer A.J. Boggs & Company."— Presentation transcript:

1 Eric Vogel Software Developer A.J. Boggs & Company

2 What’s new? New Projects for.NET 3.0 and 3.5 Framework build targeting Javascript IDE enhancements Built in Unit Testing! New language additions to C# and VB

3 New Projects Windows WPF Web ASP.NET AJAX WCF Service Office Office 2007 Workflow Smart Device Target.NET 2.0,3.0, and 3.5 Compact Frameworks. Windows Mobile 5.0, 6.0 SDK as free download.

4 .NET 3.0 Windows Presentation Foundation (WPF) Windows Forms replacement. Controls are expressed in XAML. Provides a more expressive UI layer for applications. Windows Communication Foundation (WCF) Bridges networking APIs (Web Services,.NET Remoting,..) into one API. Very configurable, supports multiple transport layers such as http and tcp. SOAP 1.1 and 1.2 complient.

5 .NET 3.0 (continued) Work Flow (WF) Allows graphical design of sequences and state machines. Good for expressing business processes. Card Space Security identification service that stores users identification information. WCF supports Card Space.

6 .NET 3.5 New language additions to C# 3.0 and VB.NET 9.0 LINQ ASP.NET AJAX WF support in WCF Services Host Work Flow in a WCF Service

7 Framework build targeting Compile projects to target a specific.NET Framework. Supports.NET 2.0,3.0, and 3.5

8 Javascript IDE Enhancements IntelliSense support added Easier to debug code Demo

9 Unit Testing Only included in Pro and Team Editions. Can create tests for Web, Desktop, and Mobile applications. Demo

10 New in C# and VB.NET Implicitly typed local variables Object intializers Array initializers Anonymous types Extension Methods Lambda Expressions LINQ

11 Implicitly typed local variables Variable declarator must have an intializer Type is inferred by the initialization of the variable Variable cannot be initialized to null Examples: C# var foo = 5; var bar = “Hello GLUG.net”; var foobar = new List (); VB Dim foo = 5; Dim bar = “Hello GLUG.net”; Dim foobar = New List(Of Integer)

12 Object initialzers Initialize properties and accessible members of an object. Nice substitute for overloaded constructors. Can be embedded Examples: C# var voyager = new Ship{Capacity=1000, Shields=200}; VB Dim voyager = New Ship With {.Capacity = 1000,.Shields = 200}

13 Implicitly typed arrays The type of the array is determined by its initialized content. Examples: C# var scores = new[] { 50, 60, 70, 70, 80, 90, 100 }; VB Dim scores() = { 50, 60, 70, 70, 80, 90, 100 }

14 Anonymous Types Create objects with anonymous types. Anonymous types inherit from Object. Examples: C# var item = new { Id=10, ItemType="Game", Cost= 29.99 }; VB Dim item = New With {.Id = 10,.ItemType = "Game",.Cost = 29.99}

15 Extension Methods Static method that extends an existing class. Invoked as if it were an instance method of the class being extended. Shadowed by member methods of the extending class. Only allowed access to public members of the extending class.

16 Extension Methods (C# example) Example: public static class ExtensionMethods { public static bool GreaterThan(this int i, int n) { return i > n; } int num = 5; num.GreaterThan(2); // will return true, since 5 is greater than 2

17 Extension Methods (VB example) Example: Imports System.Runtime.CompilerServices Public Module ExtensionMethods _ Public Function GreaterThan(ByVal i As Integer, ByVal n As Integer) As Boolean Return i > n End Function End Module Dim num As Integer = 5 num.GreaterThan(2) ) ‘ will return true, since 5 is greater than 2

18 Lambda Expressions C# (input parameters) => { expression or statement block } VB Function(input parameters) expression or statement block Provide a cleaner and more concise expression of anonymous methods. Parameters can be explicitly or implicitly typed. Have a million and one uses! Demo

19 LINQ Language INtegration Query or LINQ introduces the ability to query objects directly in the language. Syntax is very similar to SQL. Visual Studio 2008 currently has LINQ to SQL, LINQ to XML and LINQ to Objects. Demo of LINQ to Objects.

20 C# only additions Collection Intializers Automatic properties

21 Collection Initializers Collection must implement IEnumerable. Each item is added to the collection behind the scenes by calling the Add method of the collection. Examples: List names = new List { “Eric”, “Jeff”, “Joe” }; List scores = new List { 50, 60, 70, 70, 80, 90};

22 Automatic Properties More concise way to create a Property with a backing field. New default code snippet for prop in VS 2008. Examples: public int NumDays { get; set; } public DateTime DueDate { get; set; }

23 VB.NET only additions XML Literals Relaxed Delegates

24 XML literals XML is able to be used as a literal. IntelliSense support, including schemas. Tight integration with LINQ to XML. Examples: Dim products = 20 Dim appConfig =

25 Relaxed Delegates Methods no longer have to exactly match their method delegate signatures. Methods can have a derived type of what is defined in the delegate as a return type (covariance). Methods can be passed arguments with types that are base classes of the arguments specified in the delegate signature (contravariance).

26 Covariance Example Public Class Record End Class Public Class Person Inherits Record End Class Public Delegate Function RecordChanged(ByVal Id As Integer) As Record Public Function GetChangedRecord(ByVal Id As Integer) As Record Return New Record End Function Public Function GetChangedPerson(ByVal Id As Integer) As Person Return New Person End Function Sub Main() Dim changedPerson As RecordChanged = AddressOf GetChangedPerson End Sub

27 Contravariance Example Public Delegate Sub PersonSelected(ByVal Person) Public Sub RecordSelected(ByVal Record) End Sub Sub Main() 'Contravariance Dim personPicked As PersonSelected = AddressOf RecordSelected End Sub

28 Contact vogelvision@gmail.com http://ericvogel.com Twitter - @vogelvision

29 References Overview of C# 3.0 http://msdn.microsoft.com/en- us/library/bb308966.aspx#csharp3.0overview_topic1 http://msdn.microsoft.com/en- us/library/bb308966.aspx#csharp3.0overview_topic1 Overview of Visual Basic 9.0 http://msdn.microsoft.com/en- us/library/ms364068(vs.80).aspx#vb9overview_topic1 http://msdn.microsoft.com/en- us/library/ms364068(vs.80).aspx#vb9overview_topic1 Programming C# 3.0 Jesse Liberty & Donald Xie, O’Reily The LINQ Project http://msdn.microsoft.com/en- us/netframework/aa904594.aspx http://msdn.microsoft.com/en- us/netframework/aa904594.aspx


Download ppt "Eric Vogel Software Developer A.J. Boggs & Company."

Similar presentations


Ads by Google