Mocker..::..GetList<(Of <(<'T>)>)> Method (Int32, Func<(Of <(<'T>)>)>)

Gets a list with the specified number of list items, using a custom function.

Namespace:  FastMoq
Assembly:  FastMoq.Core (in FastMoq.Core.dll)

Syntax


public static List<T> GetList<T>(
	int count,
	Func<T> func
)
Public Shared Function GetList(Of T) ( _
	count As Integer, _
	func As Func(Of T) _
) As List(Of T)
public:
generic<typename T>
static List<T>^ GetList(
	int^ count, 
	Func<T>^ func
)

Type Parameters

T
The Mock Type, usually an interface.

Parameters

count
Type: Int32
The number of list items.
func
Type: Func<(Of <(<'T>)>)>
The function for creating the list items.

Return Value

List<T>.

Examples


Example of how to create a list.
C#
GetList<Model>(3, () => new Model(name: Guid.NewGuid().ToString()));
or
C#
GetList<IModel>(3, () => Mocks.CreateInstance<IModel>());