You cannot create an instance of a static type. var c = new Console();
does not work. Therefore, you cannot have an argument with a static type. In Console c
, what would c
be? The syntax of your proposed static type extension method would have to be something like this:
public static void WriteLineInGreen(static Console, string formatString,
params object[] args)
{
Console.ForeGround = ConsoleColor.Green;
Console.WriteLine(formatString, args);
}
I think that the language specification changes related to Roslyn are due to the fact that language specification inconsistencies and inaccuracies have been found while working on Roslyn. It seems not very plausible to me that any new C# language features are related to Roslyn.
Update: Well, I was wrong on this last point. As @svick points out in his comment, the much better structure of the new compiler makes it easier to implement language changes.
Another important reason is that the language and compiler development has become open source. Microsoft invites the community to participate. (See: C# 7 Work List of Features.)