本文整理汇总了C#中System.Security.IPermission.Intersect方法的典型用法代码示例。如果您正苦于以下问题:C# IPermission.Intersect方法的具体用法?C# IPermission.Intersect怎么用?C# IPermission.Intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.IPermission
的用法示例。
在下文中一共展示了IPermission.Intersect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Intersect
// Return a new object that contains the intersection of 'this' and 'target'.
public override IPermission Intersect(IPermission target)
{
// If 'target' is null, return null.
if (target == null) return null;
// Both objects must be the same type.
SoundPermission soundPerm = VerifyTypeMatch(target);
// If 'this' and 'target' are unrestricted, return a new unrestricted permission.
if (m_specifiedAsUnrestricted && soundPerm.m_specifiedAsUnrestricted)
return Clone(true, SoundPermissionState.PlayAnySound);
// Calculate the intersected permissions. If there are none, return null.
SoundPermissionState val = (SoundPermissionState)
Math.Min((Int32)m_flags, (Int32)soundPerm.m_flags);
if (val == 0) return null;
// Return a new object with the intersected permission value.
return Clone(false, val);
}