Click or drag to resize

IAssetManagerAssets Method (FuncIAsset, Boolean)


Retrieves a collection of Assets, pre-filtered through a function. e.g. a function to filter assets that have the jpg extension.

Namespace:  Ingeniux.CMS
Assembly:  Ingeniux.CMS.CSAPI (in Ingeniux.CMS.CSAPI.dll) Version: 10.5.94
Syntax
IEnumerable<IAsset> Assets(
	Func<IAsset, bool> filterCallback
)

Parameters

filterCallback
Type: SystemFuncIAsset, Boolean
Function to filter the Assets to retrieve.

Return Value

Type: IEnumerableIAsset
Collection of Assets.
Remarks
Filtering is done on the server side limiting the amount of data brought forward, rather than retrieving the complete list and filtering on the front-end.
Examples
Example filtering for assets with the jpg or jpeg extensions in custom hook:
C#
session.Site.Assets(a => { if (a.Extension == "jpg" || a.Extension == "jpeg") {
        return true;
    }
    return false;
});
See Also