diff --git a/src/Common/Common.csproj b/src/Common/Common.csproj index f4a55316..625f7fab 100644 --- a/src/Common/Common.csproj +++ b/src/Common/Common.csproj @@ -23,7 +23,6 @@ $(RootNamespace) false false - diff --git a/src/Common/Common.projitems b/src/Common/Common.projitems index 8dd73dc0..49ff30a4 100644 --- a/src/Common/Common.projitems +++ b/src/Common/Common.projitems @@ -5,4 +5,4 @@ - + \ No newline at end of file diff --git a/src/Common/DiagnosticEditProperties.cs b/src/Common/DiagnosticEditProperties.cs index 09cf5454..6f8f11d7 100644 --- a/src/Common/DiagnosticEditProperties.cs +++ b/src/Common/DiagnosticEditProperties.cs @@ -3,7 +3,7 @@ namespace Moq.Analyzers.Common; -internal record class DiagnosticEditProperties +internal record DiagnosticEditProperties { internal static readonly string EditTypeKey = nameof(EditTypeKey); internal static readonly string EditPositionKey = nameof(EditPositionKey); @@ -27,24 +27,23 @@ internal enum EditType /// /// Gets the type of edit operation to perform. /// - public EditType TypeOfEdit { get; init; } + internal EditType TypeOfEdit { get; init; } /// /// Gets the zero-based position where the edit should be applied. /// - public int EditPosition { get; init; } + internal int EditPosition { get; init; } /// /// Returns the current object as an . /// /// The current object as an immutable dictionary. - public ImmutableDictionary ToImmutableDictionary() + internal ImmutableDictionary ToImmutableDictionary() { - return new Dictionary(StringComparer.Ordinal) - { - { EditTypeKey, TypeOfEdit.ToString() }, - { EditPositionKey, EditPosition.ToString(CultureInfo.InvariantCulture) }, - }.ToImmutableDictionary(); + ImmutableDictionary.Builder builder = ImmutableDictionary.CreateBuilder(StringComparer.Ordinal); + builder.Add(EditTypeKey, TypeOfEdit.ToString()); + builder.Add(EditPositionKey, EditPosition.ToString(CultureInfo.InvariantCulture)); + return builder.ToImmutable(); } /// @@ -53,7 +52,7 @@ internal enum EditType /// The dictionary to try to convert. /// The output edit properties if parsing succeeded, otherwise null. /// true if parsing succeeded; false otherwise. - public static bool TryGetFromImmutableDictionary(ImmutableDictionary dictionary, [NotNullWhen(true)] out DiagnosticEditProperties? editProperties) + internal static bool TryGetFromImmutableDictionary(ImmutableDictionary dictionary, [NotNullWhen(true)] out DiagnosticEditProperties? editProperties) { editProperties = null; if (!dictionary.TryGetValue(EditTypeKey, out string? editTypeString))