Class ArrayParam<T>
- Namespace
- BenchmarkDotNet.Code
- Assembly
- BenchmarkDotNet.dll
public class ArrayParam<T> : IParam
Type Parameters
T
- Inheritance
-
ArrayParam<T>
- Implements
Properties
DisplayText
used to display the value (e.g. in summary in Params column)
public string DisplayText { get; }
Property Value
Value
value of the parameter object for benchmark used internally (e.g. by the InProcessToolchain)
public object Value { get; }
Property Value
Methods
ForComplexTypes(T[], Func<T, string>)
for types where calling .ToString() will be NOT enough to re-create them in auto-generated source code file
public static ArrayParam<T> ForComplexTypes(T[] array, Func<T, string> toSourceCode)
Parameters
arrayT[]the array
toSourceCodeFunc<T, string>method which transforms an item of type T to it's C# representation example: point => $"new Point2d({point.X}, {point.Y})"
Returns
- ArrayParam<T>
ForPrimitives(T[])
for types where calling .ToString() will be enough to re-create them in auto-generated source code file (integers, strings and other primitives)
public static ArrayParam<T> ForPrimitives(T[] array)
Parameters
arrayT[]
Returns
- ArrayParam<T>
ToSourceCode()
this source code is used to create parameter for benchmark in C# source code file example: $"new Point2D({Value.X}, {Value.Y})"
public string ToSourceCode()