Back to Devexpress

BoolList.SetItemValue(String, Boolean) Method

expressappframework-devexpress-dot-expressapp-dot-utils-dot-boollist-dot-setitemvalue-x28-system-dot-string-system-dot-boolean-x29.md

latest4.6 KB
Original Source

BoolList.SetItemValue(String, Boolean) Method

Assigns a new value to a particular key from the BoolList‘s collection of key/value pairs.

Namespace : DevExpress.ExpressApp.Utils

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public void SetItemValue(
    string key,
    bool value
)
vb
Public Sub SetItemValue(
    key As String,
    value As Boolean
)

Parameters

NameTypeDescription
keyString

A string representing the key from the BoolList ‘s collection of key/value pairs, to which a new value will be assigned.

| | value | Boolean |

A Boolean value to be assigned to the specified key.

|

Remarks

If a key/value pair with the specified key does not exist, it is created.

The following code snippet illustrates use of the SetItemValue method:

csharp
BoolList mylist = new BoolList();
mylist.SetItemValue("myKey", true); 
//myValue == true;

To get all keys from the BoolList ‘s collection of key/value pairs, use the BoolList.GetKeys method. To check whether a particular key exists, use the BoolList.Contains method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the SetItemValue(String, Boolean) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

xaf-how-to-implement-a-custom-security-operation-that-can-be-permitted-at-the-type-level/CS/EF/CustomPermissionEF/CustomPermissionEF.Module/Controllers/SecuredExportController.cs#L15

csharp
// exportController.ExportAction.Executing += ExportAction_Executing; // Uncomment this line and comment the next one to show the error when a user performs the forbidden action
    exportController.ExportAction.Active.SetItemValue("Security", Application.GetSecurityStrategy().IsGranted(new ExportPermissionRequest(View.ObjectTypeInfo.Type)));
}

xaf-how-to-implement-dependent-views-in-a-dashboardview-filter-based-on-selection/CS/EFCore/DependentDashboardEF/DependentDashboardEF.Module/Controllers/DashboardFilterController.cs#L42

csharp
if (recordsNavigationController != null) {
    recordsNavigationController.Active.SetItemValue("DashboardFiltering", false);
}

XAF-implement-custom-permission-role-and-user-objects/CS/EFCore/MySolutionEF/MySolutionEF.Module/Security/SecuredExportController.cs#L15

csharp
IRequestSecurity requestSecurity = (IRequestSecurity)Application.Security;
controller.Active.SetItemValue("Security",
    requestSecurity.IsGranted(new ExportPermissionRequest()));

See Also

BoolList Class

BoolList Members

DevExpress.ExpressApp.Utils Namespace