---
title: CSharp-SDK - 4.2.0
slug: feature-experimentation/release-notes/csharp-sdk-4-2-0
createdAt: 2026-07-20T15:45:15.142Z
---

## 4.2.0

[#420](docId\:MtLPXeg7MNNcD0LdfRSVA)

Nov 13, 2025

### New Features

[#new-features](docId\:MtLPXeg7MNNcD0LdfRSVA)

- **Added support for Contextual Multi-Armed Bandit (CMAB)**: Added support for CMAB experiments(Contextual Bandits rules) with new configuration options and cache control. To get decision from CMAB rules, `decide` and related methods must be used.

### CMAB Configuration Options

[#cmab-configuration-options](docId\:MtLPXeg7MNNcD0LdfRSVA)

The following new configuration options have been added for CMAB:

```javascript
using OptimizelySDK;

// Configure CMAB settings before creating the Optimizely instance
var cmabConfig = new CmabConfig()
    .SetCacheSize(1000)                        // Optional: Set CMAB cache size (default: 1000)
    .SetCacheTtl(TimeSpan.FromMinutes(30));    // Optional: Set CMAB cache TTL (default: 30 minutes)
    // .SetCache(customCache)                  // Optional: Custom cache implementation

OptimizelyFactory.SetCmabConfig(cmabConfig);

var optimizely = OptimizelyFactory.NewDefaultInstance("SDK_KEY_HERE");
```

### CMAB-Related OptimizelyDecideOptions

[#cmab-related-optimizelydecideoptions](docId\:MtLPXeg7MNNcD0LdfRSVA)

New decide options are available to control CMAB caching behavior:

- `OptimizelyDecideOption.IGNORE_CMAB_CACHE`: Bypass CMAB cache for fresh decisions
- `OptimizelyDecideOption.RESET_CMAB_CACHE`: Clear and reset CMAB cache before making decisions
- `OptimizelyDecideOption.INVALIDATE_USER_CMAB_CACHE`: Invalidate CMAB cache for the particular user and experiment

```javascript
using OptimizelySDK.OptimizelyDecisions;

// Example usage with CMAB decide options
var user = optimizely.CreateUserContext("user123");
var decision = user.Decide("feature-flag-key", new[]
{
    OptimizelyDecideOption.IGNORE_CMAB_CACHE
});
```

[https://github.com/optimizely/csharp-sdk/releases/tag/v4.2.0](https://github.com/optimizely/csharp-sdk/releases/tag/v4.2.0)
