Alex
Alex

Reputation: 36101

Why can't I use C# 4 default parameters in Mono?

Mono works fine with my app, but when I try to compile a function like

int Yo(int a, int b = 1) {
     // blah...
}

It doesn't work, it says that "Default parameter specifiers are not permitted"

According to Mono's website

The Mono C# compiler is considered feature complete for C# 1.0, C# 2.0 and C# 3.0 (ECMA). A preview of C# 4.0 is distributed with Mono 2.6, and a complete C# 4.0 implementation is available with Mono 2.8 or when building Mono from our trunk source code release.

How can I successfully compile it?

Upvotes: 1

Views: 1740

Answers (2)

Oded
Oded

Reputation: 498904

Make sure you have gotten Mono 2.8... It has not been released yet, so you will need to download the sources. The git archive page is here.

It is not ready yet, so you will need to get it from source and compile mono yourself before you can use C# 4.0 features and this is only provided that the mono team has in fact finished writing these features into their compiler.

Upvotes: 4

miguel.de.icaza
miguel.de.icaza

Reputation: 32684

Our C# 4.0 compiler is available as the "dmcs" command as opposed to the "gmcs", "smcs" or "mcs" commands.

After Mono 2.8 we will work towards having a single command line compiler that will let you select the various profiles using a flag, but for now we created different scripts that act as frontends to the API profile/language level that you want to use

Upvotes: 5

Related Questions