From c5fbf7263cf3c64d23433bfe00ebaaa61f6df4cd Mon Sep 17 00:00:00 2001 From: Maarten Balliauw Date: Tue, 10 May 2022 15:19:58 +0200 Subject: [PATCH] Re-use static variable instead of method call in TextStyle --- QuestPDF/Infrastructure/TextStyle.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/QuestPDF/Infrastructure/TextStyle.cs b/QuestPDF/Infrastructure/TextStyle.cs index d734988..826d402 100644 --- a/QuestPDF/Infrastructure/TextStyle.cs +++ b/QuestPDF/Infrastructure/TextStyle.cs @@ -22,7 +22,10 @@ namespace QuestPDF.Infrastructure internal object PaintKey { get; private set; } internal object FontMetricsKey { get; private set; } - internal static TextStyle LibraryDefault => new TextStyle + // REVIEW: Should this be a method call that news up a TextStyle, + // or can it be a static variable? + // (style mutations seem to create a clone anyway) + internal static readonly TextStyle LibraryDefault = new TextStyle { Color = Colors.Black, BackgroundColor = Colors.Transparent, @@ -37,7 +40,10 @@ namespace QuestPDF.Infrastructure WrapAnywhere = false }; - public static TextStyle Default => new TextStyle(); + // REVIEW: Should this be a method call that news up a TextStyle, + // or can it be a static variable? + // (style mutations seem to create a clone anyway) + public static readonly TextStyle Default = new TextStyle(); internal void ApplyGlobalStyle(TextStyle globalStyle) {