本文整理汇总了C#中IPolicyList.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# IPolicyList.Clear方法的具体用法?C# IPolicyList.Clear怎么用?C# IPolicyList.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPolicyList
的用法示例。
在下文中一共展示了IPolicyList.Clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveResolvers
/// <summary>
/// Remove the currently tracked resolvers from the given policy list.
/// </summary>
/// <param name="policies">Policy list to remove the resolvers from.</param>
public void RemoveResolvers(IPolicyList policies)
{
foreach(object key in keys)
{
policies.Clear<IDependencyResolverPolicy>(key);
}
keys.Clear();
}
示例2: AddPolicies
/// <summary>
/// Add policies to the <paramref name="policies"/> to configure the container to use the represented
/// <see cref="IInterceptor"/> for the supplied parameters.
/// </summary>
/// <param name="serviceType">Interface being registered.</param>
/// <param name="implementationType">Type to register.</param>
/// <param name="name">Name used to resolve the type object.</param>
/// <param name="policies">Policy list to add policies to.</param>
public override void AddPolicies(Type serviceType, Type implementationType, string name, IPolicyList policies)
{
var key = new NamedTypeBuildKey(implementationType, name);
if(IsInstanceInterceptor)
{
var policy = CreateInstanceInterceptionPolicy();
policies.Set<IInstanceInterceptionPolicy>(policy, key);
policies.Clear<ITypeInterceptionPolicy>(key);
}
else
{
var policy = CreateTypeInterceptionPolicy();
policies.Set<ITypeInterceptionPolicy>(policy, key);
policies.Clear<IInstanceInterceptionPolicy>(key);
}
}
示例3: RemoveResolvers
/// <summary>
/// Remove the currently tracked resolvers from the given policy list.
/// </summary>
/// <param name="policies">Policy list to remove the resolvers from.</param>
public void RemoveResolvers(IPolicyList policies)
{
var allKeys = new List<object>();
lock (this.keys)
{
allKeys.AddRange(this.keys);
keys.Clear();
}
foreach (object key in allKeys)
{
policies.Clear<IDependencyResolverPolicy>(key);
}
}