@@ -54,38 +54,40 @@ public static string GetResourceGroup(string vaultId)
5454 return tokens [ 3 ] ;
5555 }
5656
57+ // NOTE: Commenting code which will be used in a later sprint, but not right now.
58+
5759 /// <summary>
5860 /// Extension to convert enumerable Hashtable into a dictionary
5961 /// </summary>
6062 /// <param name="tags"></param>
6163 /// <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+ // }
7880
7981 /// <summary>
8082 /// Extension to coalesce enumerable
8183 /// </summary>
8284 /// <typeparam name="TSource">Enumerable type</typeparam>
8385 /// <param name="source">Enumerable</param>
8486 /// <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+ // }
8991
9092 /// <summary>
9193 /// Extension to remove duplicates from enumerable based on a provided key selector
@@ -95,34 +97,34 @@ public static IEnumerable<TSource> CoalesceEnumerable<TSource>(this IEnumerable<
9597 /// <param name="source">Input enumerable to remove duplicates from</param>
9698 /// <param name="keySelector">Lambda to select key</param>
9799 /// <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+ // }
115117
116118 /// <summary>
117119 /// Extension to convert dictionary to hashtable enumerable
118120 /// </summary>
119121 /// <param name="tags"></param>
120122 /// <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+ // }
127129 }
128130}
0 commit comments