Skip to content

Commit 543923c

Browse files
RazorParserOptions: Add convenience Create factory method
Add a RazorParserOptions.Create(...) convenience factory method to make it easier to create RazorParserOptions with different RazorLanguageVersion and FileKind values.
1 parent 1dc5faf commit 543923c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorParserOptions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ private RazorParserOptions(
4949
_flags = flags;
5050
}
5151

52+
public static RazorParserOptions Create(RazorLanguageVersion languageVersion, string fileKind, Action<Builder>? configure = null)
53+
{
54+
var builder = new Builder(languageVersion, fileKind);
55+
configure?.Invoke(builder);
56+
57+
return builder.ToOptions();
58+
}
59+
5260
public bool DesignTime
5361
=> _flags.IsFlagSet(Flags.DesignTime);
5462

0 commit comments

Comments
 (0)