# Load, Save and Delete Rules

## Content



### Load and Save Rules

**Rules Manager** supports loading and saving rules to an XML file. It allows loading of rule definitions using the **Load** method of the **C1RulesManager** class. The **Load** method takes **Stream** as parameter to load the rules. Similarly, **Rules Manager** enables saving of the rules definition using the **Save** method of the **C1RulesManager** class. The **Save** method takes Stream as parameter to save the rules.

### Delete a Rule

To delete a rule programmatically, use the following code.

```csharp
// Remove a rule with a specific expression
var ruleToRemove = rulesManager.Engine.Rules
    .OfType<RulesEngineExpressionRule>()
    .FirstOrDefault(r => r.Expression == "[OrderCount] < 50");
 if (ruleToRemove != null)
 {
     //Code to remove the rule
     rulesManager.Engine.Rules.Remove(ruleToRemove);
 }
```