Class ArrayExtension
Helper methods for processing arrays
Inheritance
System.Object
ArrayExtension
Namespace: SigStat.Common
Assembly: SigStat.Common.dll
Syntax
public static class ArrayExtension : object
Methods
| Improve this Doc View SourceGetCog(Double[,])
Calculates the center of gravity, assuming that each cell contains a weight value
Declaration
public static (int x, int y) GetCog(this double[, ] weightMartix)
Parameters
Type | Name | Description |
---|---|---|
System.Double[,] | weightMartix |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Int32, System.Int32> |
GetValues<T>(T[,])
Enumerates all values in a two dimensional array
Declaration
public static IEnumerable<T> GetValues<T>(this T[, ] array)
Parameters
Type | Name | Description |
---|---|---|
T[,] | array | The array to enumerate |
Returns
Type | Description |
---|---|
IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T | Array type |
SetValues<T>(T[,], T)
Sets all values in a two dimensional array to value
Declaration
public static T[, ] SetValues<T>(this T[, ] array, T value)
Parameters
Type | Name | Description |
---|---|---|
T[,] | array | Array |
T | value | New value for the array elements |
Returns
Type | Description |
---|---|
T[,] | A reference to |
Type Parameters
Name | Description |
---|---|
T | Array type |
ToArrays<T>(IEnumerable<T>, Int32)
Enumerates items into arrays of given capacity. If there are less items than 'capacity', a smaller array is returned
Declaration
public static IEnumerable<T[]> ToArrays<T>(this IEnumerable<T> items, int capacity)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | The items. |
System.Int32 | capacity | The capacity. |
Returns
Type | Description |
---|---|
IEnumerable<T[]> |
Type Parameters
Name | Description |
---|---|
T |