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

LinkDemand() private static method

private static LinkDemand ( Assembly a, RuntimeDeclSecurityActions klass, RuntimeDeclSecurityActions method ) : bool
a System.Reflection.Assembly
klass RuntimeDeclSecurityActions
method RuntimeDeclSecurityActions
return bool
		private unsafe static bool LinkDemand (Assembly a, RuntimeDeclSecurityActions *klass, RuntimeDeclSecurityActions *method)
		{
			try {
				PermissionSet ps = null;
				bool result = true;
				if (klass->cas.size > 0) {
					ps = Decode (klass->cas.blob, klass->cas.size);
					result = (SecurityManager.CheckPermissionSet (a, ps, false) == null);
				}
				if (result && (klass->noncas.size > 0)) {
					ps = Decode (klass->noncas.blob, klass->noncas.size);
					result = (SecurityManager.CheckPermissionSet (a, ps, true) == null);
				}

				if (result && (method->cas.size > 0)) {
					ps = Decode (method->cas.blob, method->cas.size);
					result = (SecurityManager.CheckPermissionSet (a, ps, false) == null);
				}
				if (result && (method->noncas.size > 0)) {
					ps = Decode (method->noncas.blob, method->noncas.size);
					result = (SecurityManager.CheckPermissionSet (a, ps, true) == null);
				}
				return result;
			}
			catch (SecurityException) {
				return false;
			}
		}