Skip to content

Commit cdb6156

Browse files
author
AslamNazeerShaikh
committed
Simplyfied New Keyword Usage.
1 parent a7dd63a commit cdb6156

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

ClassCodeLibrary/StringDuplicationFiltering/StringDuplicationFilteringLinq.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ public static void ExecuteCode()
5151
/// Removes duplicate characters while preserving the original order.
5252
/// </summary>
5353
public static string RemoveDuplicatesLinq(this string input) =>
54-
new string(input.Distinct().ToArray());
54+
new(input.Distinct().ToArray());
5555

5656
/// <summary>
5757
/// Removes duplicate special characters while preserving others.
5858
/// </summary>
5959
public static string RemoveDuplicateSpecialCharsLinq(this string input) =>
60-
new string(input.GroupBy(c => c)
60+
new(input.GroupBy(c => c)
6161
.Select(g => g.Key)
6262
.Where(c => char.IsLetterOrDigit(c) || input.IndexOf(c) == input.LastIndexOf(c))
6363
.ToArray());
@@ -66,7 +66,7 @@ public static string RemoveDuplicateSpecialCharsLinq(this string input) =>
6666
/// Removes duplicate numbers while preserving others.
6767
/// </summary>
6868
public static string RemoveDuplicateNumbersLinq(this string input) =>
69-
new string(input.GroupBy(c => c)
69+
new(input.GroupBy(c => c)
7070
.Select(g => g.Key)
7171
.Where(c => !char.IsDigit(c) || input.IndexOf(c) == input.LastIndexOf(c))
7272
.ToArray());
@@ -75,7 +75,7 @@ public static string RemoveDuplicateNumbersLinq(this string input) =>
7575
/// Removes duplicate lowercase characters while preserving others.
7676
/// </summary>
7777
public static string RemoveDuplicateLowerCharsLinq(this string input) =>
78-
new string(input.GroupBy(c => c)
78+
new(input.GroupBy(c => c)
7979
.Select(g => g.Key)
8080
.Where(c => !char.IsLower(c) || input.IndexOf(c) == input.LastIndexOf(c))
8181
.ToArray());
@@ -84,7 +84,7 @@ public static string RemoveDuplicateLowerCharsLinq(this string input) =>
8484
/// Removes duplicate uppercase characters while preserving others.
8585
/// </summary>
8686
public static string RemoveDuplicateUpperCharsLinq(this string input) =>
87-
new string(input.GroupBy(c => c)
87+
new(input.GroupBy(c => c)
8888
.Select(g => g.Key)
8989
.Where(c => !char.IsUpper(c) || input.IndexOf(c) == input.LastIndexOf(c))
9090
.ToArray());
@@ -93,24 +93,24 @@ public static string RemoveDuplicateUpperCharsLinq(this string input) =>
9393
/// Removes all special characters from the input string.
9494
/// </summary>
9595
public static string RemoveSpecialCharsLinq(this string input) =>
96-
new string(input.Where(char.IsLetterOrDigit).ToArray());
96+
new(input.Where(char.IsLetterOrDigit).ToArray());
9797

9898
/// <summary>
9999
/// Removes all numeric characters from the input string.
100100
/// </summary>
101101
public static string RemoveNumbersLinq(this string input) =>
102-
new string(input.Where(c => !char.IsDigit(c)).ToArray());
102+
new(input.Where(c => !char.IsDigit(c)).ToArray());
103103

104104
/// <summary>
105105
/// Removes all lowercase characters from the input string.
106106
/// </summary>
107107
public static string RemoveLowerCharsLinq(this string input) =>
108-
new string(input.Where(c => !char.IsLower(c)).ToArray());
108+
new(input.Where(c => !char.IsLower(c)).ToArray());
109109

110110
/// <summary>
111111
/// Removes all uppercase characters from the input string.
112112
/// </summary>
113113
public static string RemoveUpperCharsLinq(this string input) =>
114-
new string(input.Where(c => !char.IsUpper(c)).ToArray());
114+
new(input.Where(c => !char.IsUpper(c)).ToArray());
115115
}
116116
}

0 commit comments

Comments
 (0)