New Features in .Net Framework 4.0 By Nyros Developer
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

New Features in .Net Framework 4.0 By Nyros Developer

  • 3,513 views
Uploaded on

New Features in .Net Framework 4.0 By Nyros Developer

New Features in .Net Framework 4.0 By Nyros Developer

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
3,513
On Slideshare
3,513
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
74
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. WELCOME TO ALL
  • 2. New Features in .NET Framework 4.0
  • 3. * Visual Studio 2008 may be better than sliced bread, but the development team at Microsoft has already been working on the next release. * They have recently given us Visual Studio 2010 and the .NET Framework 4.0 as a Community Technology Preview (CTP); it boasts several features that would appeal to developers.
  • 4. * This article will go into features that are the most relevant to .NET developers. * Please note that because this is a CTP, it doesn't mean that the final release will be exactly as you see in the CTP or as is described here. * I can go over the features roughly as follows :
  • 5. * Call Hierarchy of methods * A New Quick Search * Implicit Line Continuations * The dynamic type * Optional Parameters * Named and Optional Arguments
  • 6. * In complicated solutions, a single method may be used from several different places, and attempting to follow how a particular method is being called can be difficult. * In other words, you can look at what calls your method and what your method calls in a treeview format.
  • 7. protected void Page_Load(object sender, EventArgs e) { BindDataControls() }   private void BindDataControls() { //DataBinding here }   protected void Button1_Click(object sender, EventArgs e) { BindDataControls(); }
  • 8. * Now, if you wanted to figure out what calls BindDataControls(), you can right-click on it and choose "View Call Hierarchy.“ * This is a helpful visual cue for very complicated projects that we've all worked on at some point or another. * This gives you a window with a treeview format, as shown below :
  • 9.  
  • 10. A New Quick Search : * This isn't the same as the Search or Search and Replace window that searches for specific textual strings. * It's different in the sense that it searches across symbols (methods, properties, and class names) across your solution and filters them in the result view for you.
  • 11. Example :
  • 12. Implicit Line Continuations : * C# has had this for a long time—long lines of code can be split across several lines for more readability. * VB.NET has had it, but you've always had to add an underscore (_) at the end of each line, which could get a little annoying. * Certain types of statements can now be split across several lines without the _ required.
  • 13. Example : Dim breakfast = { New Crumpets With { .CrumpetAge = 221, .CrumpetSmell = "Foul" }, New Crumpets With { .CrumpetSmell = "good", .CrumpetAge = 1 } }
  • 14. The dynamic type : * C# 4.0 introduces a new static type called dynamic. When you have an object of type dynamic you can “do things to it” that are resolved only at runtime: * dynamic d = GetDynamicObject(…); d.M(7);
  • 15. * The C# compiler allows you to call a method with any name and any arguments on d because it is of type dynamic. *At runtime the actual object that d refers to will be examined to determine what it means to “call M with an int” on it.
  • 16. Optional Parameters : * A parameter is declared optional simply by providing a default value for it: public void M(int x, int y = 5, int z = 7); * Here y and z are optional parameters and can be omitted in calls: M(1, 2, 3); // ordinary call of M M(1, 2); // omitting z – equivalent to M(1, 2, 7) M(1); //omitting both y & z – equivalent to M(1, 5, 7)
  • 17. Named and optional arguments : * C# 4.0 does not permit you to omit arguments between commas as in M(1,,3). * This could lead to highly unreadable comma-counting code. Instead any argument can be passed by name. * Thus if you want to omit only y from a call of M you can write:
  • 18. M(1, z: 3); // passing z by name Or M(x: 1, z: 3); // passing both x and z by name Or M(z: 3, x: 1); // reversing the order of arguments
  • 19. Thank You