Skip to content

Commit

Permalink
style: Use collection expressions
Browse files Browse the repository at this point in the history
Instead of creating a new Array of strings, use collection expressions.
This addresses IDE0030 warnings.

Signed-off-by: Kevin Locke <[email protected]>
  • Loading branch information
kevinoid committed Nov 20, 2024
1 parent 95f9f70 commit 6845a69
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions NLCaseConvert/NameCapitalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,12 @@ public Builder()

// https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Arabic#Capitalization
// https://en.wikipedia.org/wiki/Arabic_name
Array.AsReadOnly(new[]
{
Array.AsReadOnly([
"al-",
"as-",
"ash-",
"at-",
});
]);

/// <summary>
/// Gets a pattern to match name prefixes from the Celtic language
Expand All @@ -146,13 +145,12 @@ public Builder()

// https://en.wikipedia.org/wiki/List_of_Scottish_Gaelic_surnames#Mac-
// https://en.wikipedia.org/wiki/Celtic_onomastics#Surname_prefixes
Array.AsReadOnly(new[]
{
Array.AsReadOnly([
@"ill[e']",
@"ma?c(\s+an?|')?",
@"ó",
@"o'",
});
]);

/// <summary>
/// Gets a pattern to match name prefixes from the Celtic language
Expand All @@ -162,10 +160,9 @@ public Builder()

// https://en.wikipedia.org/wiki/List_of_Scottish_Gaelic_surnames#Mac-
// https://en.wikipedia.org/wiki/Celtic_onomastics#Surname_prefixes
Array.AsReadOnly(new[]
{
Array.AsReadOnly([
@"t-",
});
]);

/// <summary>
/// Gets a pattern to match words which are excluded from
Expand All @@ -179,16 +176,15 @@ public Builder()

// https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Arabic#Capitalization
// https://en.wikipedia.org/wiki/Patronymic#Arabic
Array.AsReadOnly(new[]
{
Array.AsReadOnly([
@"ab[uū]",
@"ben",
@"bin",
@"bint",
@"bte[.]?",
@"ibn",
@"umm",
});
]);

/// <summary>
/// Gets a pattern to match words which are excluded from
Expand All @@ -205,14 +201,13 @@ public Builder()
// https://english.stackexchange.com/a/185889
// https://en.wikipedia.org/wiki/Van_(Dutch)#Related_prepositions
// TODO: Does Belgian or German capitalization convention differ?
Array.AsReadOnly(new[]
{
Array.AsReadOnly([
@"de[nr]?",
@"het",
@"mes",
@"te[nr]?",
@"van",
});
]);

/// <summary>
/// Gets a pattern to match Italian name prefixes.
Expand All @@ -223,12 +218,12 @@ public Builder()
// capitalized for historical figures (before surnames existed)
// but are for contemporary surnames.
// https://www.thoughtco.com/italian-capitalization-rules-2011478
Array.AsReadOnly(new[]
{
Array.AsReadOnly([

// Note: di and di prefixes currently excluded due to too
// many false-positives (Dennis, Denver, Diego, Diana)
@"d'",
});
]);

/// <summary>
/// Gets a pattern to match a word with at least one uppercase or
Expand Down

0 comments on commit 6845a69

Please sign in to comment.