C# 6.0 String Interpolation in Mono MCS

2019-06-25 00:04发布

问题:

I'm using latest Mono 3.12.1. All of the C#6 features are working for me, apart from string interpolation. I'm using MCS compiler.

Here's my code:

const string someString = "Some String";
var str = $"string: {someString}";

I'm getting the following error:

error CS1056: Unexpected character `$'

Is string interpolation supported by Mono?

回答1:

You need a newer version of Mono for this, it will be part of the Mono 4.0 release, which has been branched, but has not been published yet.

So you will need to build it yourself for now



标签: mono c#-6.0