Share via


New Operator Support

For .NET Framework 3.5, the Windows Workflow Foundation (WF) rules engine has added support for the two CodeDom elements: CodeObjectCreateExpression and CodeCreateArrayExpression. This allows you to utilize the new operator in your rules instead of, for example, using the Activator.CreateInstance method to create a type instance through late binding.

For example, your Rule can now look like the following:

IF this.NewCustomer == true THEN this.Order = new CustomerOrder()

This example shows that if the given comparison evaluates to true, then a new CustomerOrder instance is created.

You can also create new instances of single dimension arrays in your Rule objects, as shown in the following example:

IF this.Order.MultipleAddresses == true THEN this.Order.Address.AddRange(new Address[2] {address1,address2})

Note

You will get a validation error in .NET Framework 3.0 if you try to create any expressions that rely on this new functionality.

See Also

Other Resources

Rule Changes in .NET Framework 3.5