PowerArgs.ArgRequiredConditionalHook.AfterPopulateProperties C# (CSharp) Method

AfterPopulateProperties() public method

public AfterPopulateProperties ( PowerArgs.ArgHook context ) : void
context PowerArgs.ArgHook
return void
        public override void AfterPopulateProperties(ArgHook.HookContext context)
        {
            if(parent.If != null && parent.IfNot != null)
            {
                throw new InvalidArgDefinitionException("You cannot specify both the 'If' and the 'IfNot' properties on the ArgRequired metadata");
            }
            else if(parent.If != null)
            {
                Evaluate(context, parent.If, false);
            }
            else if (parent.IfNot != null)
            {
                Evaluate(context, parent.IfNot, true);
            }
            else
            {
                throw new InvalidOperationException("ArgRequired could not determine if the given argument was required.  This is likely a bug in PowerArgs.");
            }
        }