-->

dev csharp

Personally I think this one is a bit trivial. So the argument is it eliminates the need for using hard-coded strings in the code.

For instance:

public class NameofOperator
{
    public void Run(SomeClass someClass)
    {
        if (someClass == null)
        {
            throw new ArgumentNullException("someClass");
        }
    }
}

public class SomeClass
{
}

Say you refactored the code and changed the parameter name in this example. It is likely to forget changing the name in the exception throwing line since it has no reference to the actual parameter.

By using nameof operator we can avoid such mistakes:

public class NameofOperator
{
    public void Run(SomeClass refactoredName)
    {
        if (refactoredName == null)
        {
            throw new ArgumentNullException(nameof(refactoredName));
        }
    }
}

public class SomeClass
{
}

The results are identical but this way when we change a parameter name all references to that object will be updated automatically.

dev csharp

In current C# a collection initialization can be done like this:

var result = new Dictionary<string, string>();
result.Add("index1", "value1");
result.Add("index2", "value2");

or key - value pairs can be added during initialization

var result = new Dictionary<string, string>() 
{
	{"index1", "value1"},
	{"index2", "value2"}
};

With C# 6.0 values at specific indices can be initialized like this:

var result = new Dictionary<string, string>() 
{
	["index1"] = "value1",
	["index2"] = "value2"
};

It’s a shorthand but not so much! I don’t see much value in this notation but I’m sure in time it will prove itself. I don’t think the guys in the language team are just adding random features!

dev csharp

It’s a shorthand for writing methods. The body now can be written just like a Lambda expression as shown in Log2 method below:

public string Log(string timestamp, string application, string error, string status)
{
    return string.Format("[Timestamp: \{timestamp}], Application: [\{application}], Error: [\{error}], Status [\{status}]");
}

public string Log2(string timestamp, string application, string error, string status) => string.Format("[Timestamp: \{timestamp}], Application: [\{application}], Error: [\{error}], Status [\{status}]");

It may come in handy for helper methods. The only benefit I can see is getting rid of opening and closing curly braces which generally don’t bother me much. But I know lots of people trying to avoid curly braces as much as possible. I’m sure this feature will be popular among them.