@@ -54,38 +54,40 @@ public static string GetResourceGroup(string vaultId)
54
54
return tokens [ 3 ] ;
55
55
}
56
56
57
+ // NOTE: Commenting code which will be used in a later sprint, but not right now.
58
+
57
59
/// <summary>
58
60
/// Extension to convert enumerable Hashtable into a dictionary
59
61
/// </summary>
60
62
/// <param name="tags"></param>
61
63
/// <returns></returns>
62
- public static Dictionary < string , string > ConvertToDictionary ( this Hashtable [ ] tags )
63
- {
64
- return tags == null
65
- ? null
66
- : tags
67
- . CoalesceEnumerable ( )
68
- . Select ( hashTable => hashTable . OfType < DictionaryEntry > ( )
69
- . ToDictionary ( kvp => kvp . Key . ToString ( ) , kvp => kvp . Value ) )
70
- . Where ( tagDictionary => tagDictionary . ContainsKey ( "Name" ) )
71
- . Select ( tagDictionary => Tuple
72
- . Create (
73
- tagDictionary [ "Name" ] . ToString ( ) ,
74
- tagDictionary . ContainsKey ( "Value" ) ? tagDictionary [ "Value" ] . ToString ( ) : string . Empty ) )
75
- . Distinct ( kvp => kvp . Item1 )
76
- . ToDictionary ( kvp => kvp . Item1 , kvp => kvp . Item2 ) ;
77
- }
64
+ // public static Dictionary<string, string> ConvertToDictionary(this Hashtable[] tags)
65
+ // {
66
+ // return tags == null
67
+ // ? null
68
+ // : tags
69
+ // .CoalesceEnumerable()
70
+ // .Select(hashTable => hashTable.OfType<DictionaryEntry>()
71
+ // .ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value))
72
+ // .Where(tagDictionary => tagDictionary.ContainsKey("Name"))
73
+ // .Select(tagDictionary => Tuple
74
+ // .Create(
75
+ // tagDictionary["Name"].ToString(),
76
+ // tagDictionary.ContainsKey("Value") ? tagDictionary["Value"].ToString() : string.Empty))
77
+ // .Distinct(kvp => kvp.Item1)
78
+ // .ToDictionary(kvp => kvp.Item1, kvp => kvp.Item2);
79
+ // }
78
80
79
81
/// <summary>
80
82
/// Extension to coalesce enumerable
81
83
/// </summary>
82
84
/// <typeparam name="TSource">Enumerable type</typeparam>
83
85
/// <param name="source">Enumerable</param>
84
86
/// <returns></returns>
85
- public static IEnumerable < TSource > CoalesceEnumerable < TSource > ( this IEnumerable < TSource > source )
86
- {
87
- return source ?? Enumerable . Empty < TSource > ( ) ;
88
- }
87
+ // public static IEnumerable<TSource> CoalesceEnumerable<TSource>(this IEnumerable<TSource> source)
88
+ // {
89
+ // return source ?? Enumerable.Empty<TSource>();
90
+ // }
89
91
90
92
/// <summary>
91
93
/// Extension to remove duplicates from enumerable based on a provided key selector
@@ -95,34 +97,34 @@ public static IEnumerable<TSource> CoalesceEnumerable<TSource>(this IEnumerable<
95
97
/// <param name="source">Input enumerable to remove duplicates from</param>
96
98
/// <param name="keySelector">Lambda to select key</param>
97
99
/// <returns></returns>
98
- public static IEnumerable < TSource > Distinct < TSource , TKeyType > ( this IEnumerable < TSource > source , Func < TSource , TKeyType > keySelector )
99
- {
100
- var set = new Dictionary < TKeyType , TSource > ( EqualityComparer < TKeyType > . Default ) ;
101
- foreach ( TSource element in source )
102
- {
103
- TSource value ;
104
- var key = keySelector ( element ) ;
105
- if ( ! set . TryGetValue ( key , out value ) )
106
- {
107
- yield return element ;
108
- }
109
- else
110
- {
111
- set [ key ] = value ;
112
- }
113
- }
114
- }
100
+ // public static IEnumerable<TSource> Distinct<TSource, TKeyType>(this IEnumerable<TSource> source, Func<TSource, TKeyType> keySelector)
101
+ // {
102
+ // var set = new Dictionary<TKeyType, TSource>(EqualityComparer<TKeyType>.Default);
103
+ // foreach (TSource element in source)
104
+ // {
105
+ // TSource value;
106
+ // var key = keySelector(element);
107
+ // if (!set.TryGetValue(key, out value))
108
+ // {
109
+ // yield return element;
110
+ // }
111
+ // else
112
+ // {
113
+ // set[key] = value;
114
+ // }
115
+ // }
116
+ // }
115
117
116
118
/// <summary>
117
119
/// Extension to convert dictionary to hashtable enumerable
118
120
/// </summary>
119
121
/// <param name="tags"></param>
120
122
/// <returns></returns>
121
- public static Hashtable [ ] GetTagsHashtables ( this IDictionary < string , string > tags )
122
- {
123
- return tags == null
124
- ? null
125
- : tags . Select ( kvp => new Hashtable { { "Name" , kvp . Key } , { "Value" , kvp . Value } } ) . ToArray ( ) ;
126
- }
123
+ // public static Hashtable[] GetTagsHashtables(this IDictionary<string, string> tags)
124
+ // {
125
+ // return tags == null
126
+ // ? null
127
+ // : tags.Select(kvp => new Hashtable { { "Name", kvp.Key }, { "Value", kvp.Value } }).ToArray();
128
+ // }
127
129
}
128
130
}
0 commit comments