1 / 16

.NET 3.5 – Mysteries

.NET 3.5 – Mysteries. NetFx Evolution. NetFx 3.5 Feature List. Automatic Properties Object and Collection Initializers Extension Methods Lambda Expressions Implicit Typing Anonymous Method/Types Partial Methods LINQ. Automatic Properties. Two-in-one. Clean, Compact and Concise.

rhea
Download Presentation

.NET 3.5 – Mysteries

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. .NET 3.5 – Mysteries

  2. NetFx Evolution

  3. NetFx 3.5 Feature List • Automatic Properties • Object and Collection Initializers • Extension Methods • Lambda Expressions • Implicit Typing • Anonymous Method/Types • Partial Methods • LINQ

  4. Automatic Properties • Two-in-one. • Clean, Compact and Concise. • Makes Visual Basic programmers jealous . • Speed, speed, speed! public class Person {        public string FirstName { get; set; }    } public class Person {        private string _firstName;        public string FirstName {            get {                return _firstName;            }            set {                _firstName = value;            }        }

  5. Object and Collection Initializers • Did you C this? • What’s the best one-liner of .Net? • Object and Collection Initializers. • Named assignments. • Isn’t intelliSense just wonderful? • A little helping hand. Personperson = new Person(); person.FirstName = "Scott"; person.LastName = "Guthrie“; person.Age = 32; great "syntactic sugar" language feature called "object Initializers" that allows you to-do this and re-write the above code like so: Personperson = new Person { FirstName="Scott", LastName="Guthrie", Age=32 };

  6. Extension Methods • Static Implementation. • Scoped in namespace. • Limited access and Low priority. • Fuel for the LINQ Engine. string email = Request.QueryString["email"];if ( email.IsValidEmailAddress() ) {}

  7. Lambda Expressions • The next step… • Concise and not that complex. • Just like anonymous method, but smaller. • Can be converted to a Expression Tree. • Why do we need it?

  8. Implicit Typing • It’s implicit, not dynamic. • Specific rules to follow. • Helps with LINQ • Helps with Generic Extension Methods • Helps with Lambda Expressions

  9. Anonymous Methods • create inline un-named methods in your code int[] EvenInts = Array.FindAll (Ints, delegate(intints) { return (ints % 2 == 0); } );

  10. Anonymous Types • allow you to create a class structure on the fly. var dog = new { Breed = "Cocker Spaniel", Coat = "black", FerocityLevel = 1 };

  11. Partial Methods • Its also not a method defined in two files. • So, what is a partial method after all? • A separation of declaration and definition. • What, how can it disappear? • Why do we need it? partial class PartialMethods //Part 1{   static void Main()   {      Do();    }    static partial void Do();} partial class PartialMethods //Part 2{   static partial void Do() {}}

  12. All concepts in one code

  13. LINQ The Mysterious LINQ

  14. LINQ • So, what is LINQ(Language-INtegratedQuery)? • It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities. • LINQ to SQL. • LINQ to Objects. • LINQ to XML. • How does it work?

  15. Summary • Did we miss the Foundations? • What about Service Pack 1? • WPF improvements • .NET Framework 3.5 SP1 Optimized Client Runtime • New ADO.NET Data Features • ADO.NET Entity Framework • ADO.NET Data Services • New ASP.NET Features • ASP.NET Dynamic Data • Improved ASP.NET AJX Support • Why 3.5 when 4 is already out? • Can I use Visual Studio 2010 with 3.5? • Yes, because of multi-targeting feature

  16. Thank You

More Related