Friday, May 1, 2015

What's new in C# 6



Roslyn open source

  IDE Features (CTL+.)
  . lightball to remove unused namespace
    .. fix the scope , remove all unused cross the project / solutions
  . refactor
    rename, introduce local variable, show conflict
    add this automaticaly if their is conflict that could be resolved by IDE
  . Array vs ImmutableArray

  var c=new ImmutableArray(); call c.length will trigger null exception.
  //you can build code analyzer
  //tell the ide you shoudl you  ImmutableArray<int>.empty

language new features
  instead of big change, little things added.

  1.using static System.Console. //simar typescript import {WriteLine} from systemcnosole

    then you can call WriteLine methods.
  2.Immutable, auto property.
    public class Point
    {
      public int x {get;}
      public int y {get;}=default10;
    }
  3 lambda for methods
    public void string ToString()=>String.format("tostring {0}", x);

  4 $String,
    public void String toString()=>$({X}{Y})
  5. nameof(variable)
    Log.d(nameof(variable))
  6.?.
    if p!=null && p.name=="xxx"
    will be if p?.name=="xx"
    if json!=null && json['x']!=null && json['x']=="mon"
    will be
    if(json?['x']?=="mon")
  7.initlize elements
    public JObject tojson()=>return new jsonobject(){['x']=x, ['Y']=y }
  8. awit in catch block

    try
    {
    var result=await repo.DosomethingAsync();
    }
    catch(Excepton ex)
    {
      await repo.LogException(ex) //doable now
    }

  9.catch(Exception ex) when (ex.Occurences>3)


Debugging features
  1. you can edit code, even add new class , and do initialization code when debugging the app
    run linq query

    also in watch window
    people.find(p=>p.age>20)

  C# extensions toolkit in the extnsion gallery
  2. C# interactive window

      #r "System"
      #r "System.Core"
      using System.Diagnostics;
      using System.linq;
      var memoryPigs =from p in Process.getProcesses() where p.workset64 >64*1024*1024 select new
      {p.ProcessName, p.WorkingSet}
      foreach(var r in memopigs)
      {
      Console.writeline(r)7y
      }

1 comment:

Be Tvastra | Digital Marketing Company in Chennai said...

Hi this is SaiVijay, I'am from Chennai. I'am a technical writer for a digital marketing company in Chennai for more than five years. And its my own passion to choose this field. I have to write a creative articles, novels, documents. My hobbies are drawing, playing foot ball and playing cricket also. My most favorite one is "Be Tvastra" which one is the most memorable one in my works. I have suggest you to read the articles.
Digital Marketing Company in Chennai
Digital Marketing Agency in Chennai
SEO services in Chennai
SEO company in Chennai
Web Design Company in Chennai
Web Development Company in Chennai
top 10 digital marketing companies in chennai
digital marketing companies in chennai
best digital marketing agency in chennai
digital marketing companies in anna nagar
seo services company in chennai
Best SEO Companies In Chennai
cheap seo in chennai

 
Locations of visitors to this page