To add some details, the F# compiler uses different approach for representing optional parameters, which is not (currently) compatible with the C# 4.0 approach. F# simply allows you to use a nicer syntax when the parameter has type option<'a> (and is marked as optional). You can use it as it is, or you can use the defaultArg function to provide default value in your code.
In C#, the parameter is represented specially in the meta-data (.NET 4.0 specific feature), and the default value is specified in the meta-data. Unfortunately, there is no way to create C# 4.0 compatible optional parameter in F#.
If you want to make the C# code a little-bit nicer, you can define a static utility class that allows you to use type inference when creating option<'a> values:
static class FSharpOption {
static FSharpOption<T> Some<T>(T value) {
return new FSharpOption<T>(value);
}
}
// Then you can write just:
var myObj1 = new Person(FSharpOption.Some("mark"));
Or you can modify your F# declaration to use overloaded methods/constructors, which works in both of the languages:
type Person(name) =
do printfn "%s" name
// Add overloaded constructor with default value of name'
new () = Person("")