Class ArrayExtensions
Inherited Members
Namespace: System
Assembly: Acoustics.Shared.dll
Syntax
public static class ArrayExtensions
Methods
| Improve this Doc View SourceCompare<T>(T[], T[])
Compares two arrays, matching each element in order using the default Equals method for the array type T.
Declaration
public static bool Compare<T>(this T[] arr1, T[] arr2)
Parameters
Type | Name | Description |
---|---|---|
T[] | arr1 | The first array to compare. |
T[] | arr2 | The second array to compare. |
Returns
Type | Description |
---|---|
Boolean | True: If each element matches; otherwise: False. |
Type Parameters
Name | Description |
---|---|
T | The common type of each array. |
FastFill<T>(T[], T[])
A helper method designed to fill an array with the specified values. Modifies the array in place, return value is only for fluent method calling. Fast is a bit of a misnomer - this operation is only faster after about a million elements!.
Declaration
public static T[] FastFill<T>(this T[] destinationArray, params T[] value)
Parameters
Type | Name | Description |
---|---|---|
T[] | destinationArray | The array being filled. |
T[] | value | The value[s] to insert into the array. |
Returns
Type | Description |
---|---|
T[] |
Type Parameters
Name | Description |
---|---|
T | They type of the array. |
Remarks
https://github.com/mykohsu/Extensions/blob/master/ArrayExtensions.cs Inspired from several Stack Overflow discussions and an implementation by David Walker at http://coding.grax.com/2011/11/initialize-array-to-value-in-c-very.html.
Fill<T>(T[], T)
A helper method designed to fill an array with the specified values. Modifies the array in place, return value is only for fluent method calling.
Declaration
public static T[] Fill<T>(this T[] destinationArray, T value)
Parameters
Type | Name | Description |
---|---|---|
T[] | destinationArray | The array being filled. |
T | value | The value[s] to insert into the array. |
Returns
Type | Description |
---|---|
T[] |
Type Parameters
Name | Description |
---|---|
T | They type of the array. |
Remarks
https://github.com/mykohsu/Extensions/blob/master/ArrayExtensions.cs Inspired from several Stack Overflow discussions and an implementation by David Walker at http://coding.grax.com/2011/11/initialize-array-to-value-in-c-very.html.
GetMaxValue(Double[])
retrieving the max value of a vector.
Declaration
public static double GetMaxValue(this double[] data)
Parameters
Type | Name | Description |
---|---|---|
Double[] | data |
Returns
Type | Description |
---|---|
Double |
GetMinValue(Double[])
retrieving the min value of a vector.
Declaration
public static double GetMinValue(this double[] data)
Parameters
Type | Name | Description |
---|---|---|
Double[] | data |
Returns
Type | Description |
---|---|
Double |
Print<T>(T[])
Debug function used to print an array to console (Debug.WriteLine()).
Declaration
public static T[] Print<T>(this T[] array)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to print. |
Returns
Type | Description |
---|---|
T[] | The same array that was input. |
Type Parameters
Name | Description |
---|---|
T | The type of the input array. |
PrintAsLiteral<T>(Array)
Prints a multi-dimensional matrix as a C# literal.
Declaration
public static string PrintAsLiteral<T>(this Array array)
Parameters
Type | Name | Description |
---|---|---|
Array | array | The source array to print. |
Returns
Type | Description |
---|---|
String |
Type Parameters
Name | Description |
---|---|
T | Cast element items to T before toString is called. |
Remarks
Assumes all ranks have a lower bound of zero.