当前位置: 首页>>代码示例>>C#>>正文


C# FileIOPermission.Union方法代码示例

本文整理汇总了C#中System.Security.Permissions.FileIOPermission.Union方法的典型用法代码示例。如果您正苦于以下问题:C# FileIOPermission.Union方法的具体用法?C# FileIOPermission.Union怎么用?C# FileIOPermission.Union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.Permissions.FileIOPermission的用法示例。


在下文中一共展示了FileIOPermission.Union方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Union_Bug79118

		public void Union_Bug79118 ()
		{
			string[] f1 = unix ? new string[] { "/tmp/one", "/tmp/two" } : new string[] { "c:\\temp\\one", "c:\\temp\\two" };
			string[] f2 = unix ? new string[] { "/tmp/two" } : new string[] { "c:\\temp\\two" };

			p = new FileIOPermission (FileIOPermissionAccess.Read, f1);
			p2 = new FileIOPermission (FileIOPermissionAccess.Read, f2);
			FileIOPermission union = (FileIOPermission) p.Union (p2);

			string[] paths = union.GetPathList(FileIOPermissionAccess.Read);
			Assert.AreEqual (2, paths.Length, "Length");
			Assert.AreEqual (f1[0], paths[0], "0");
			Assert.AreEqual (f1[1], paths[1], "1");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:14,代码来源:FileIOPermissionTest.cs

示例2: Partial

		private void Partial (string msg, string[] path1, string[] path2, int expected)
		{
			p = new FileIOPermission (FileIOPermissionAccess.Read, path1);
			p2 = new FileIOPermission (FileIOPermissionAccess.Read, path2);
			FileIOPermission union = (FileIOPermission) p.Union (p2);

			string[] paths = union.GetPathList(FileIOPermissionAccess.Read);
			Assert.AreEqual (expected, paths.Length, msg + ".Length");
			Assert.AreEqual (path1[0], paths[0], msg + "[0]");
			if (expected > 1)
				Assert.AreEqual (path2[0], paths[1], msg + "[1]");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:12,代码来源:FileIOPermissionTest.cs

示例3: Union

		public void Union ()
		{
			unrestricted = new FileIOPermission(PermissionState.Unrestricted);
			p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);

			FileIOPermission union = (FileIOPermission)unrestricted.Union(p);
			pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
			Assert.IsTrue(union.IsUnrestricted(), "Should get an unrestricted permission");
			Assert.IsTrue(pathsInPermission == null, "Path list should be empty");

			union = (FileIOPermission)p.Union(unrestricted);
			pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
			Assert.IsTrue(union.IsUnrestricted(), "Should get an unrestricted permission");
			Assert.IsTrue(pathsInPermission == null, "Path list should be empty");

			p2 = new FileIOPermission(FileIOPermissionAccess.Append, pathArrayGood2);

			union = (FileIOPermission)p.Union(p2);
			pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
			Assert.IsTrue(pathsInPermission.Length == pathArrayGood.Length, "Path list should have 2 for Read");
			pathsInPermission = union.GetPathList(FileIOPermissionAccess.Append);
			Assert.IsTrue(pathsInPermission.Length == pathArrayGood2.Length, "Path list should have 3 for Append");

			union = (FileIOPermission)p2.Union(p);
			pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
			Assert.IsTrue(pathsInPermission.Length == pathArrayGood.Length, "Path list should have 2 for Read");
			pathsInPermission = union.GetPathList(FileIOPermissionAccess.Append);
			Assert.IsTrue(pathsInPermission.Length == pathArrayGood2.Length, "Path list should have 3 for Append");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:29,代码来源:FileIOPermissionTest.cs


注:本文中的System.Security.Permissions.FileIOPermission.Union方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。