File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
src/Microsoft.OpenApi/Writers
test/Microsoft.OpenApi.Tests/PublicApi Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 22// Licensed under the MIT license.
33
44using System ;
5- using System . Collections ;
65using System . Collections . Generic ;
76using System . Globalization ;
87using System . IO ;
9- using System . Reflection ;
108using System . Threading ;
119using System . Threading . Tasks ;
1210using Microsoft . OpenApi . Exceptions ;
@@ -213,13 +211,14 @@ public virtual void WriteValue(bool value)
213211 }
214212
215213 /// <summary>
216- /// Write hashSet value.
214+ /// Writes an enumerable collection as an array
217215 /// </summary>
218- /// <param name="value">The HashSet value.</param>
219- public virtual void WriteHashSet ( IEnumerable < object > value )
216+ /// <param name="collection">The enumerable collection to write.</param>
217+ /// <typeparam name="T">The type of elements in the collection.</typeparam>
218+ public virtual void WriteEnumerable < T > ( IEnumerable < T > collection )
220219 {
221220 WriteStartArray ( ) ;
222- foreach ( var item in value )
221+ foreach ( var item in collection )
223222 {
224223 WriteValue ( item ) ;
225224 }
@@ -280,9 +279,9 @@ public virtual void WriteValue(object value)
280279 {
281280 WriteValue ( ( DateTimeOffset ) value ) ;
282281 }
283- else if ( value is IEnumerable < object > hashSet && value . GetType ( ) . GetGenericTypeDefinition ( ) == typeof ( HashSet < > ) )
282+ else if ( value is IEnumerable < object > enumerable )
284283 {
285- WriteHashSet ( hashSet ) ;
284+ WriteEnumerable ( enumerable ) ;
286285 }
287286 else
288287 {
Original file line number Diff line number Diff line change @@ -1973,7 +1973,7 @@ namespace Microsoft.OpenApi.Writers
19731973 protected void VerifyCanWritePropertyName(string name) { }
19741974 public abstract void WriteEndArray();
19751975 public abstract void WriteEndObject();
1976- public virtual void WriteHashSet (System.Collections.Generic.IEnumerable<object> value ) { }
1976+ public virtual void WriteEnumerable<T> (System.Collections.Generic.IEnumerable<T> collection ) { }
19771977 public virtual void WriteIndentation() { }
19781978 public abstract void WriteNull();
19791979 public abstract void WritePropertyName(string name);
You can’t perform that action at this time.
0 commit comments