Share via

ResourceContext.Clone Method


Creates a clone of this ResourceContext, with identical qualifiers.

 virtual ResourceContext ^ Clone() = Clone;
ResourceContext Clone();
public ResourceContext Clone();
function clone()
Public Function Clone () As ResourceContext


A new, cloned ResourceContext.


// Use a cloned context so that qualifier values set
// in this scenario don't impact behavior in other scenarios that
// use a default context for the view (crossover effects between
// the scenarios will not be expected).
var context = ResourceContext.GetForCurrentView().Clone();


By default, a cloned context has the same qualifier values as the default context from which it was derived. If a qualifier value in the default context changes, the changes are reflected in the cloned context as well. However, if a qualifier value is programmatically overridden on the cloned context, the linkage to the default context for that qualifier is removed— changes to that qualifier value in the cloned context do not affect the default context, and vice versa. This linkage can be restored using the Reset method.

Applies to