Skip to content

Instantly share code, notes, and snippets.

@7sharp9
Last active Dec 17, 2015
Embed
What would you like to do?
Example of record construction syntax for multiple constructors
[ProjectFileTypeDefinition(Name)]
public class HtmlProjectFileType : KnownProjectFileType
{
public new const string Name = "HTML";
public const string HTML_EXTENSION = ".html";
public const string HTM_EXTENSION = ".htm";
public new static readonly HtmlProjectFileType Instance;
private HtmlProjectFileType() : base(Name, "Html", new[] {HTML_EXTENSION, HTM_EXTENSION}) { }
protected HtmlProjectFileType(string name) : base(name) { }
protected HtmlProjectFileType(string name, string presentableName) : base(name, resentableName) { }
protected HtmlProjectFileType(string name, string presentableName, IEnumerable<string> extensions) : base(name, presentableName, extensions) { }
}
[<Literal>]let Name = "F#"
[<Literal>]let PresentableName = "FSHARP"
[<Literal>]let FS_EXTENSION = ".fs"
[<ProjectFileTypeDefinition(Name)>]
type FSharpProjectFileType =
inherit KnownProjectFileType
new() = {inherit KnownProjectFileType(Name, PresentableName, [|FS_EXTENSION|]) }
new(name) = {inherit KnownProjectFileType(name) }
new(name, presentableName) = { inherit KnownProjectFileType(name, presentableName) }
new(name, presentableName, extensions) = { inherit KnownProjectFileType(name, presentableName, extensions) }
[<DefaultValue>] static val mutable private instance: FSharpProjectFileType
static member Instance with get() = FSharpProjectFileType()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment