System.Security.PermissionSetCollection.DemandChoice C# (CSharp) Method

DemandChoice() private method

private DemandChoice ( ) : void
return void
		internal void DemandChoice ()
		{
			SecurityException exception = null;
			bool result = false;
			foreach (PermissionSet pset in _list) {
				try {
					pset.Demand ();
					result = true;
					break;
				}
				catch (SecurityException se) {
					// keep the first failure, we may throw it if we not succeed
					if (exception == null)
						exception = se;
				}
			}

			if (!result) {
				if (exception != null)
					throw exception;
				else
					throw new SecurityException ("DemandChoice failed.");
			}
		}