Skip to content

Allow Extension properties setters in initializers #301

Description

@baronfel

Allow Extension properties setters in initializers [6200089]

Submitted by Paul on 7/21/2014 12:00:00 AM
6 votes on UserVoice prior to migration

I suggest we consider allowing ExtensionProperty=expr property setters in initializers.
For example
C(ExtensionProperty = [1;2;3])
Or for example to provide c# “add” pattern like support
type StackLayout with
member x.ChildrenInitializer with set (values : UIElement seq)=
values |> Seq.iter x.Children.Add
let layout = StackLayout (Orientation = StackOrientation.Horizonta,
ChildrenInitializer = [Entry(Placeholder = “Username”);Entry()])

Response

** by fslang-admin on 1/21/2015 12:00:00 AM **

This has now been completed for F# 4.0+, see dotnet/fsharp#17 and https://github.com/fsharp/FSharpLangDesign/blob/master/FSharp-4.0/ExtensionPropertyInitializersDesignAndSpec.md

Original UserVoice Submission
Archived Uservoice Comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions