本文整理汇总了C#中System.Security.Permissions.EnvironmentPermission.Intersect方法的典型用法代码示例。如果您正苦于以下问题:C# EnvironmentPermission.Intersect方法的具体用法?C# EnvironmentPermission.Intersect怎么用?C# EnvironmentPermission.Intersect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Permissions.EnvironmentPermission
的用法示例。
在下文中一共展示了EnvironmentPermission.Intersect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IntersectWithBadPermission
public void IntersectWithBadPermission ()
{
EnvironmentPermission ep1 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, envVariables);
FileDialogPermission fdp2 = new FileDialogPermission (PermissionState.Unrestricted);
EnvironmentPermission ep3 = (EnvironmentPermission) ep1.Intersect (fdp2);
}
示例2: IntersectWithUnrestricted
public void IntersectWithUnrestricted ()
{
EnvironmentPermission ep1 = new EnvironmentPermission (PermissionState.Unrestricted);
EnvironmentPermission ep2 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, envVariables);
EnvironmentPermission ep3 = (EnvironmentPermission) ep1.Intersect (ep2);
Assert ("Unrestricted N EP2 == EP2", !ep3.IsUnrestricted ());
AssertEquals ("Unrestricted N EP2 == EP2", ep2.ToXml ().ToString (), ep3.ToXml ().ToString ());
ep3 = (EnvironmentPermission) ep2.Intersect (ep1);
Assert ("EP2 N Unrestricted == EP2", !ep3.IsUnrestricted ());
AssertEquals ("EP2 N Unrestricted == EP2", ep2.ToXml ().ToString (), ep3.ToXml ().ToString ());
}
示例3: Intersect
public void Intersect ()
{
// no intersection
EnvironmentPermission ep1 = new EnvironmentPermission (EnvironmentPermissionAccess.Write, envVariables);
EnvironmentPermission ep2 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, envVariables);
EnvironmentPermission ep3 = (EnvironmentPermission) ep1.Intersect (ep2);
AssertNull ("EP1 N EP2 == null", ep3);
// intersection in read
EnvironmentPermission ep4 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, "TMP");
ep3 = (EnvironmentPermission) ep4.Intersect (ep2);
AssertEquals ("Intersect-Read", "TMP", ep3.GetPathList (EnvironmentPermissionAccess.Read));
// intersection in write
EnvironmentPermission ep5 = new EnvironmentPermission (EnvironmentPermissionAccess.Write, "TEMP");
ep3 = (EnvironmentPermission) ep5.Intersect (ep1);
AssertEquals ("Intersect-Read", "TEMP", ep3.GetPathList (EnvironmentPermissionAccess.Write));
// intersection in read and write
EnvironmentPermission ep6 = new EnvironmentPermission (EnvironmentPermissionAccess.AllAccess, "TEMP");
EnvironmentPermission ep7 = new EnvironmentPermission (EnvironmentPermissionAccess.AllAccess, envVariables);
ep3 = (EnvironmentPermission) ep6.Intersect (ep7);
AssertEquals ("Intersect-AllAccess-Read", "TEMP", ep3.GetPathList (EnvironmentPermissionAccess.Read));
AssertEquals ("Intersect-AllAccess-Write", "TEMP", ep3.GetPathList (EnvironmentPermissionAccess.Write));
}
示例4: IntersectWithNull
public void IntersectWithNull ()
{
EnvironmentPermission ep1 = new EnvironmentPermission (EnvironmentPermissionAccess.Read, envVariables);
EnvironmentPermission ep2 = null;
EnvironmentPermission ep3 = (EnvironmentPermission) ep1.Intersect (ep2);
AssertNull ("EP1 N null == null", ep3);
}