Class Extensions
Contains general extensions.
Inheritance
Inherited Members
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public static class Extensions
Methods
Append<T>(T[], T)
Creates a new array appending the given element.
Declaration
public static T[] Append<T>(this T[] array, T other)
Parameters
T[]
array
|
T
other
|
Returns
T[]
|
Type Parameters
T
|
Append<T>(T[], T[])
Creates a new array appending the given array.
Declaration
public static T[] Append<T>(this T[] array, T[] other)
Parameters
T[]
array
|
T[]
other
|
Returns
T[]
|
Type Parameters
T
|
Append<T>(T[], T[], Int32)
Creates a new array appending the given array but only the first 'count' elements.
Declaration
public static T[] Append<T>(this T[] array, T[] other, int count)
Parameters
T[]
array
|
T[]
other
|
System.Int32
count
|
Returns
T[]
|
Type Parameters
T
|
CopyTo<T>(T[], T[], Int32, Int32, Int32)
Copies elements to the given target.
Declaration
public static void CopyTo<T>(this T[] array, T[] target, int index, int sourceIndex, int count)
Parameters
T[]
array
|
T[]
target
|
System.Int32
index
|
System.Int32
sourceIndex
|
System.Int32
count
|
Type Parameters
T
|
EnsureMinimumSize<T>(ArrayBase<T>, Int64)
Ensures that this
Declaration
public static void EnsureMinimumSize<T>(this ArrayBase<T> array, long minimumSize)
Parameters
ArrayBase<T>
array
This array. |
System.Int64
minimumSize
The minimum number of elements that this array must fit. |
Type Parameters
T
The type of element stored in this array. |
EnsureMinimumSize<T>(ArrayBase<T>, Int64, T)
Ensures that this
Declaration
public static void EnsureMinimumSize<T>(this ArrayBase<T> array, long minimumSize, T fillValue)
Parameters
ArrayBase<T>
array
This array. |
System.Int64
minimumSize
The minimum number of elements that this array must fit. |
T
fillValue
The value to use to fill in the empty spaces if we have to resize. |
Type Parameters
T
The type of element stored in this array. |
MoveNextUntil<T>(IEnumerator<T>, Func<T, Boolean>)
Moves this enumerator until a given condition is met.
Declaration
public static bool MoveNextUntil<T>(this IEnumerator<T> enumerator, Func<T, bool> stopHere)
Parameters
IEnumerator<T>
enumerator
|
Func<T, System.Boolean>
stopHere
|
Returns
System.Boolean
|
Type Parameters
T
|
NextPowerOfTwo(Int32)
Gets the next power of two.
Declaration
public static int NextPowerOfTwo(int i)
Parameters
System.Int32
i
|
Returns
System.Int32
|
ReadToEnd(Stream)
Reads a string.
Declaration
public static string ReadToEnd(this Stream stream)
Parameters
System.IO.Stream
stream
|
Returns
System.String
|
ReadWithSizeAttributesCollection(Stream)
Reads an attributes collection.
Declaration
public static IAttributeCollection ReadWithSizeAttributesCollection(this Stream stream)
Parameters
System.IO.Stream
stream
|
Returns
IAttributeCollection
|
ReadWithSizeString(Stream)
Reads a string.
Declaration
public static string ReadWithSizeString(this Stream stream)
Parameters
System.IO.Stream
stream
|
Returns
System.String
|
ReadWithSizeStringArray(Stream)
Reads a string array.
Declaration
public static string[] ReadWithSizeStringArray(this Stream stream)
Parameters
System.IO.Stream
stream
|
Returns
System.String[]
|
Reverse<T>(T[])
Reverse the elements in the given array.
Declaration
public static void Reverse<T>(this T[] array)
Parameters
T[]
array
|
Type Parameters
T
|
ReverseAndCopy<T>(T[])
Returns a copy of the given array with the elements reversed.
Declaration
public static T[] ReverseAndCopy<T>(this T[] array)
Parameters
T[]
array
|
Returns
T[]
|
Type Parameters
T
|
SchrinkAndCopyMatrix<T>(T[][], HashSet<Int32>)
Shrinks and copies the matrix and removes rows/columns with indices in the toRemove set.
Declaration
public static T[][] SchrinkAndCopyMatrix<T>(this T[][] matrix, HashSet<int> toRemove)
Parameters
T[][]
matrix
|
HashSet<System.Int32>
toRemove
|
Returns
T[][]
|
Type Parameters
T
|
SeekBegin(BinaryWriter, Int64)
Sets the position within the given stream.
Declaration
public static long SeekBegin(this BinaryWriter stream, long offset)
Parameters
BinaryWriter
stream
|
System.Int64
offset
|
Returns
System.Int64
|
ShrinkAndCopyArray<T>(T[], HashSet<Int32>)
Shrinks and copies the given array, removes elements with indices in the toRemove set.
Declaration
public static T[] ShrinkAndCopyArray<T>(this T[] list, HashSet<int> toRemove)
Parameters
T[]
list
|
HashSet<System.Int32>
toRemove
|
Returns
T[]
|
Type Parameters
T
|
ShrinkAndCopyList<T>(List<T>, HashSet<Int32>)
Shrinks and copies the given list, removes elements with indices in the toRemove set.
Declaration
public static List<T> ShrinkAndCopyList<T>(this List<T> list, HashSet<int> toRemove)
Parameters
List<T>
list
|
HashSet<System.Int32>
toRemove
|
Returns
List<T>
|
Type Parameters
T
|
SubArray<T>(T[], Int32, Int32)
Creates a new sub-array, containing the element starting at index, with the given length.
Declaration
public static T[] SubArray<T>(this T[] array, int index, int length)
Parameters
T[]
array
|
System.Int32
index
|
System.Int32
length
|
Returns
T[]
|
Type Parameters
T
|
ToInvariantString(Object)
Returns a string representing the object in a culture invariant way.
Declaration
public static string ToInvariantString(this object obj)
Parameters
System.Object
obj
|
Returns
System.String
|
ToStringSafe<T>(T[])
Returns a string for the given array even when null.
Declaration
public static string ToStringSafe<T>(this T[] array)
Parameters
T[]
array
|
Returns
System.String
|
Type Parameters
T
|
TryGetValueOrDefault<TKey, TValue>(Dictionary<TKey, TValue>, TKey)
Gets the value associated with the specified key or returns the default.
Declaration
public static TValue TryGetValueOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key)
Parameters
Dictionary<TKey, TValue>
dictionary
|
TKey
key
|
Returns
TValue
|
Type Parameters
TKey
|
TValue
|
WriteWithSize(IAttributeCollection, Stream)
Writes an attributes collection to the given stream and prefixed with it's size.
Declaration
public static long WriteWithSize(this IAttributeCollection attributes, Stream stream)
Parameters
IAttributeCollection
attributes
|
System.IO.Stream
stream
|
Returns
System.Int64
|
WriteWithSize(Stream, Byte[])
Writes the given value with size prefix.
Declaration
public static long WriteWithSize(this Stream stream, byte[] value)
Parameters
System.IO.Stream
stream
|
System.Byte[]
value
|
Returns
System.Int64
|
WriteWithSize(Stream, String)
Writes the given value with size prefix.
Declaration
public static long WriteWithSize(this Stream stream, string value)
Parameters
System.IO.Stream
stream
|
System.String
value
|
Returns
System.Int64
|
WriteWithSize(Stream, String[])
Writes the given value with size prefix.
Declaration
public static long WriteWithSize(this Stream stream, string[] values)
Parameters
System.IO.Stream
stream
|
System.String[]
values
|
Returns
System.Int64
|