System.Security.SecurityManager.SecurityManager.CheckPermissionSet C# (CSharp) Method

CheckPermissionSet() static private method

static private CheckPermissionSet ( Assembly a, PermissionSet ps, bool noncas ) : IPermission
a System.Reflection.Assembly
ps PermissionSet
noncas bool
return IPermission
		internal static IPermission CheckPermissionSet (Assembly a, PermissionSet ps, bool noncas)
		{
			if (ps.IsEmpty ())
				return null;

			foreach (IPermission p in ps) {
				// note: this may contains non CAS permissions
				if ((!noncas) && (p is CodeAccessPermission)) {
#if NET_2_0
					if (!IsGranted (a, p))
						return p;
#else
					if (p is IUnrestrictedPermission) {
						if (!IsGranted (a, p))
							return p;
					} else {
						if (!IsGrantedRestricted (a, p))
							return p;
					}
#endif
				} else {
					// but non-CAS will throw on failure...
					try {
						p.Demand ();
					}
					catch (SecurityException) {
						// ... so we catch
						return p;
					}
				}
			}
			return null;
		}

Same methods

SecurityManager.SecurityManager::CheckPermissionSet ( AppDomain ad, PermissionSet ps ) : IPermission