Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# 6.0 String Interpolation in Mono MCS

Tags:

mono

c#-6.0

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?

like image 750
Ilya Suzdalnitski Avatar asked Jan 08 '23 16:01

Ilya Suzdalnitski


1 Answers

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

like image 105
miguel.de.icaza Avatar answered Jan 30 '23 22:01

miguel.de.icaza