diff --git a/src/AvaloniaMath/Extensions.cs b/src/AvaloniaMath/Extensions.cs index 61baac9d..f5322cfb 100644 --- a/src/AvaloniaMath/Extensions.cs +++ b/src/AvaloniaMath/Extensions.cs @@ -18,11 +18,10 @@ public static byte[] RenderToPng(this TexFormula texForm, PngBitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(image)); - using (var ms = new MemoryStream()) - { - encoder.Save(ms); - return ms.ToArray(); - } + using var ms = new MemoryStream(); + + encoder.Save(ms); + return ms.ToArray(); } } } diff --git a/src/WpfMath/Extensions.cs b/src/WpfMath/Extensions.cs index 982138f5..73656d69 100644 --- a/src/WpfMath/Extensions.cs +++ b/src/WpfMath/Extensions.cs @@ -19,11 +19,10 @@ public static byte[] RenderToPng(this TexFormula texForm, PngBitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(image)); - using (var ms = new MemoryStream()) - { - encoder.Save(ms); - return ms.ToArray(); - } + using var ms = new MemoryStream(); + + encoder.Save(ms); + return ms.ToArray(); } } } diff --git a/src/XamlMath.Shared/Boxes/GlueBox.cs b/src/XamlMath.Shared/Boxes/GlueBox.cs index 5475dcae..5dee632c 100644 --- a/src/XamlMath.Shared/Boxes/GlueBox.cs +++ b/src/XamlMath.Shared/Boxes/GlueBox.cs @@ -12,17 +12,9 @@ public GlueBox(double space, double stretch, double shrink) this.Shrink = shrink; } - public double Stretch - { - get; - private set; - } + public double Stretch { get; } - public double Shrink - { - get; - private set; - } + public double Shrink { get; } public override void RenderTo(IElementRenderer renderer, double x, double y) { diff --git a/src/XamlMath.Shared/Boxes/OverUnderBox.cs b/src/XamlMath.Shared/Boxes/OverUnderBox.cs index 88fa9435..261dfef6 100644 --- a/src/XamlMath.Shared/Boxes/OverUnderBox.cs +++ b/src/XamlMath.Shared/Boxes/OverUnderBox.cs @@ -23,37 +23,17 @@ public OverUnderBox(Box baseBox, Box delimiterBox, Box? scriptBox, double kern, (!over && scriptBox != null ? scriptBox.Height + scriptBox.Depth + kern : 0.0); } - public Box BaseBox - { - get; - private set; - } + public Box BaseBox { get; } - public Box DelimiterBox - { - get; - private set; - } + public Box DelimiterBox { get; } - public Box? ScriptBox - { - get; - private set; - } + public Box? ScriptBox { get; } // Kern between delimeter and Script. - public double Kern - { - get; - private set; - } + public double Kern { get; } // True to draw delimeter and script over base; false to draw under base. - public bool Over - { - get; - private set; - } + public bool Over { get; } public override void RenderTo(IElementRenderer renderer, double x, double y) { diff --git a/src/XamlMath.Shared/CharFont.cs b/src/XamlMath.Shared/CharFont.cs index 9677532a..17e088d8 100644 --- a/src/XamlMath.Shared/CharFont.cs +++ b/src/XamlMath.Shared/CharFont.cs @@ -9,16 +9,8 @@ public CharFont(char character, int fontId) this.FontId = fontId; } - public char Character - { - get; - private set; - } + public char Character { get; } - public int FontId - { - get; - private set; - } + public int FontId { get; } } } diff --git a/src/XamlMath.Shared/DefaultTexFont.cs b/src/XamlMath.Shared/DefaultTexFont.cs index dc6fbc1d..3dda407c 100644 --- a/src/XamlMath.Shared/DefaultTexFont.cs +++ b/src/XamlMath.Shared/DefaultTexFont.cs @@ -51,11 +51,7 @@ public DefaultTexFont(IFontProvider fontProvider, double size) public bool SupportsMetrics => true; - public double Size - { - get; - private set; - } + public double Size { get; } public ExtensionChar GetExtension(CharInfo charInfo, TexStyle style) { diff --git a/src/XamlMath.Shared/ExtensionChar.cs b/src/XamlMath.Shared/ExtensionChar.cs index 4fcda1d5..349e4a2c 100644 --- a/src/XamlMath.Shared/ExtensionChar.cs +++ b/src/XamlMath.Shared/ExtensionChar.cs @@ -11,28 +11,9 @@ public ExtensionChar(CharInfo? top, CharInfo? middle, CharInfo? bottom, CharInfo this.Bottom = bottom; } - public CharInfo? Top - { - get; - private set; - } - - public CharInfo? Middle - { - get; - private set; - } - - public CharInfo? Bottom - { - get; - private set; - } - - public CharInfo? Repeat - { - get; - private set; - } + public CharInfo? Top { get; } + public CharInfo? Middle { get; } + public CharInfo? Bottom { get; } + public CharInfo? Repeat { get; } } } diff --git a/src/XamlMath.Shared/Glue.cs b/src/XamlMath.Shared/Glue.cs index 70d61d05..a876c152 100644 --- a/src/XamlMath.Shared/Glue.cs +++ b/src/XamlMath.Shared/Glue.cs @@ -32,29 +32,10 @@ public Glue(double space, double stretch, double shrink, string name) this.Name = name; } - public double Space - { - get; - private set; - } - - public double Stretch - { - get; - private set; - } - - public double Shrink - { - get; - private set; - } - - public string Name - { - get; - private set; - } + public double Space { get; } + public double Stretch { get; } + public double Shrink { get; } + public string Name { get; } private Box CreateBox(TexEnvironment environment) { diff --git a/src/XamlMath.Shared/TexFontInfo.cs b/src/XamlMath.Shared/TexFontInfo.cs index 75327a03..7dd04821 100644 --- a/src/XamlMath.Shared/TexFontInfo.cs +++ b/src/XamlMath.Shared/TexFontInfo.cs @@ -33,35 +33,11 @@ public TexFontInfo(int fontId, IFontTypeface font, double xHeight, double space, this.SkewCharacter = (char)1; } - public int FontId - { - get; - private set; - } - - public IFontTypeface Font - { - get; - private set; - } - - public double XHeight - { - get; - private set; - } - - public double Space - { - get; - private set; - } - - public double Quad - { - get; - private set; - } + public int FontId { get; } + public IFontTypeface Font { get; } + public double XHeight { get; } + public double Space { get; } + public double Quad { get; } // Skew character (used for positioning accents). public char SkewCharacter diff --git a/src/XamlMath.Shared/TexPredefinedFormulaParser.cs b/src/XamlMath.Shared/TexPredefinedFormulaParser.cs index 484d8767..89493cc4 100644 --- a/src/XamlMath.Shared/TexPredefinedFormulaParser.cs +++ b/src/XamlMath.Shared/TexPredefinedFormulaParser.cs @@ -176,11 +176,7 @@ public void Parse( private class ReturnParser : IActionParser { - public TexFormula? Result - { - get; - private set; - } + public TexFormula? Result { get; private set; } public void Parse( SourceSpan source,