Skip to content

Commit 4100fdf

Browse files
committed
remove deprecated ExclusiveAdd()
1 parent e995227 commit 4100fdf

File tree

1 file changed

+5
-32
lines changed

1 file changed

+5
-32
lines changed

src/Utility.CommandLine.Arguments/Arguments.cs

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ namespace Utility.CommandLine
3535
using System.Collections.Concurrent;
3636
using System.Collections.Generic;
3737
using System.Diagnostics;
38-
using System.Diagnostics.CodeAnalysis;
3938
using System.Linq;
4039
using System.Reflection;
4140
using System.Runtime.CompilerServices;
@@ -46,37 +45,6 @@ namespace Utility.CommandLine
4645
/// </summary>
4746
public static class ArgumentsExtensions
4847
{
49-
/// <summary>
50-
/// Adds the specified key to the specified dictionary with the specified value, but only if the specified key is not
51-
/// already present in the dictionary. If it is present, a list is created and the new value is added to the list,
52-
/// along with all subsequent values.
53-
/// </summary>
54-
/// <param name="dictionary">The dictionary to which they specified key and value are to be added.</param>
55-
/// <param name="key">The key to add to the dictionary.</param>
56-
/// <param name="value">The value corresponding to the specified key.</param>
57-
internal static void ExclusiveAdd(this Dictionary<string, object> dictionary, string key, object value)
58-
{
59-
if (!dictionary.ContainsKey(key))
60-
{
61-
dictionary.Add(key, value);
62-
}
63-
else
64-
{
65-
var type = dictionary[key].GetType();
66-
67-
if (dictionary[key].GetType() == typeof(List<object>))
68-
{
69-
((List<object>)dictionary[key]).Add(value);
70-
}
71-
else
72-
{
73-
object existingValue = dictionary[key];
74-
75-
dictionary[key] = new List<object>(new object[] { existingValue, value });
76-
}
77-
}
78-
}
79-
8048
/// <summary>
8149
/// Gets the DeclaringType of the first method on the stack whose name matches the specified <paramref name="caller"/>.
8250
/// </summary>
@@ -97,6 +65,11 @@ internal static Type GetCallingType(string caller)
9765
return callingMethod.DeclaringType;
9866
}
9967

68+
/// <summary>
69+
/// Removes the outermost pair of enclosing quotes.
70+
/// </summary>
71+
/// <param name="value">The string to trim.</param>
72+
/// <returns>The trimmed string.</returns>
10073
internal static string TrimOuterQuotes(this string value)
10174
{
10275
if (value.StartsWith("\"") && value.EndsWith("\""))

0 commit comments

Comments
 (0)