Skip to main content

CollectionExtensions

Assembly: ServiceStack.Text.dll​
View Source​
Declaration
public static class CollectionExtensions

Methods​

CreateAndPopulate<T>(Type, T[])​

View Source​
Declaration
public static ICollection<T> CreateAndPopulate<T>(Type ofCollectionType, T[] withItems)
Returns​

System.Collections.Generic.ICollection<<T>>

Parameters​
TypeName
System.TypeofCollectionType
<T>[]withItems
Type Parameters​
  • T

ToArray<T>(ICollection<T>)​

View Source​
Declaration
public static T[] ToArray<T>(this ICollection<T> collection)
Returns​

<T>[]

Parameters​
TypeName
System.Collections.Generic.ICollection<<T>>collection
Type Parameters​
  • T

Convert<T>(Object, Type)​

View Source​
Declaration
public static object Convert<T>(object objCollection, Type toCollectionType)
Returns​

System.Object

Parameters​
TypeName
System.ObjectobjCollection
System.TypetoCollectionType
Type Parameters​
  • T

OrEmpty<T>(IEnumerable<T>)​

Return T[0] when enumerable is null, safe to use in enumerations like foreach

View Source​
Declaration
public static IEnumerable<T> OrEmpty<T>(this IEnumerable<T> enumerable)
Returns​

System.Collections.Generic.IEnumerable<<T>>

Parameters​
TypeName
System.Collections.Generic.IEnumerable<<T>>enumerable
Type Parameters​
  • T

OrEmpty(IEnumerable)​

View Source​
Declaration
public static IEnumerable OrEmpty(this IEnumerable enumerable)
Returns​

System.Collections.IEnumerable

Parameters​
TypeName
System.Collections.IEnumerableenumerable