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


C# Action.ThrowIfNull方法代码示例

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


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

示例1: MessageInputHandler

        public MessageInputHandler(WorldInstance worldInstance, MessageRendererState messageRendererState, TimeSpan totalTime, Action<IXnaGameTime> messageClosingDelegate)
        {
            worldInstance.ThrowIfNull("worldInstance");
            messageRendererState.ThrowIfNull("messageRendererState");
            messageClosingDelegate.ThrowIfNull("messageClosingDelegate");

            _worldInstance = worldInstance;
            _messageRendererState = messageRendererState;
            _messageClosingDelegate = messageClosingDelegate;
            _answerKeyboardStateHelper = new KeyboardStateHelper(
                KeyDown,
                null,
                null,
                TextAdventure.Xna.Constants.MessageRenderer.Input.AcceptKey,
                TextAdventure.Xna.Constants.MessageRenderer.Input.NextAnswerKey,
                TextAdventure.Xna.Constants.MessageRenderer.Input.PreviousAnswerKey);
            _scrollKeyboardStateHelper = new KeyboardStateHelper(
                _scrollKeyboardRepeatHelper,
                TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollUpKey,
                TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollDownKey,
                TextAdventure.Xna.Constants.MessageRenderer.Input.HomeKey,
                TextAdventure.Xna.Constants.MessageRenderer.Input.EndKey,
                TextAdventure.Xna.Constants.MessageRenderer.Input.PageUpKey,
                TextAdventure.Xna.Constants.MessageRenderer.Input.PageDownKey);
            _scrollKeyboardRepeatHelper.InitialInterval = TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollKeyboardInterval;
            _scrollKeyboardRepeatHelper.RepeatingInterval = TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollKeyboardInterval;
        }
开发者ID:tj-miller,项目名称:TextAdventure,代码行数:27,代码来源:MessageInputHandler.cs

示例2: BeginInvoke

        /// <summary>
        /// Invokes asynchronously the specified action for this control.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="action">The action.</param>
        public static void BeginInvoke(Control control, Action action)
        {
            control.ThrowIfNull("control");
            action.ThrowIfNull("action");
            if (!control.Created || control.IsDisposed || !control.IsHandleCreated) return;

            control.BeginInvoke(action);
        }
开发者ID:liquidsnk,项目名称:Aspid,代码行数:13,代码来源:ControlUtils.cs

示例3: CssCommentaryInterpreter

        public CssCommentaryInterpreter(Action<Int32, Int32> onOpen, Action<String, Int32, Int32> onClose)
        {
            onOpen.ThrowIfNull("onOpen");
            onClose.ThrowIfNull("onClose");

            this.onOpen = onOpen;
            this.onClose = onClose;
        }
开发者ID:gBritz,项目名称:CssSyntax,代码行数:8,代码来源:CssCommentaryInterpreter.cs

示例4: ReactiveCommand

        public ReactiveCommand(
			Action<object> execute,
			Func<object, bool> canExecute,
			params INotifyPropertyChanged[] canExecuteNotifiers)
        {
            _execute = execute.ThrowIfNull();
            _canExecute = canExecute.ThrowIfNull();
            _canExecuteNotifiers = canExecuteNotifiers;

            _canExecuteNotifiers.ForEach(x => x.SubscribeWeakly(this, (c, s, e) => c.NotifyCanExecuteChanged()));
        }
开发者ID:EamonNerbonne,项目名称:FunTools,代码行数:11,代码来源:ReactiveCommand.cs

示例5: WeakAction

 public WeakAction(Action action)
 {
     action.ThrowIfNull("action");
     _method = action.GetMethodInfo();
     if (action.GetMethodInfo().IsStatic)
     {
         _staticAction = action;
     }
     if (action.Target != null)
     {
         _actionTargetReference = new WeakReference(action.Target);
     }
 }
开发者ID:ryanhorath,项目名称:Rybird.Framework,代码行数:13,代码来源:WeakAction.cs

示例6: MessageFadeOutAndScaleUpdater

        public MessageFadeOutAndScaleUpdater(MessageRendererState messageRendererState, TimeSpan totalTime, Action completeDelegate)
        {
            messageRendererState.ThrowIfNull("messageRendererState");
            completeDelegate.ThrowIfNull("completeDelegate");
            if (totalTime < TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException("totalTime");
            }

            _messageRendererState = messageRendererState;
            _completeDelegate = completeDelegate;
            _timedLerpHelper = new TimedLerpHelper(totalTime, TextAdventure.Xna.Constants.MessageRenderer.FadeOutDuration, 1f, 0f);
        }
开发者ID:nathan-alden,项目名称:old-text-adventure,代码行数:13,代码来源:MessageFadeOutAndScaleUpdater.cs

示例7: TimerHelper

        public TimerHelper(TimeSpan startTotalTime, TimeSpan duration, Action completedDelegate)
        {
            completedDelegate.ThrowIfNull("completedDelegate");
            if (startTotalTime < TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException("startTotalTime");
            }
            if (duration < TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException("duration");
            }

            _duration = duration;
            _startTotalTime = startTotalTime;
            _completedDelegate = completedDelegate;
        }
开发者ID:tj-miller,项目名称:TextAdventure,代码行数:16,代码来源:TimerHelper.cs

示例8: Invoke

        /// <summary>
        /// Invokes the specified action for this control.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="action">The action.</param>
        public static void Invoke(Control control, Action action)
        {
            control.ThrowIfNull("control");
            action.ThrowIfNull("action");
            if (!control.Created || control.IsDisposed || !control.IsHandleCreated) return;

            try
            {
                control.Invoke(action);
            }
            catch (ObjectDisposedException ex)
            {
                logger.LogError("Control {0} disposed while trying to process an Invoke on it".InvariantFormat(control.Name));
                logger.LogException(ex);
            }
            catch (InvalidOperationException ioe)
            {
                logger.LogError("Invalid operation exception triggered by {0} control while trying to invoke".InvariantFormat(control.Name));
                logger.LogException(ioe);
            }
        }
开发者ID:liquidsnk,项目名称:Aspid,代码行数:26,代码来源:ControlUtils.cs

示例9: Transaction

 private void Transaction(Action<IDbConnection, IDbTransaction> action)
 {
     action.ThrowIfNull("action");
     using(var conn = this.GetConnection()) {
         using(var tx = conn.BeginTransaction()) {
             try {
                 action(conn, tx);
                 tx.Commit();
             } catch {
                 tx.Rollback();
                 throw;
             }
         }
     }
 }
开发者ID:catwalkagogo,项目名称:Heron,代码行数:15,代码来源:DBStorage.cs

示例10: RelayCommand

 public RelayCommand(Action<object> execute, Predicate<object> canExecute)
 {
     this.execute = execute.ThrowIfNull();
     this.canExecute = canExecute;
 }
开发者ID:joseph-iussa,项目名称:feed-reader,代码行数:5,代码来源:RelayCommand.cs

示例11: RelayCommand

 public RelayCommand(Action<object> execute, Predicate<object> canExecute)
 {
     execute.ThrowIfNull("execute");
     _execute = execute; _canExecute = canExecute;
 }
开发者ID:CookieWookie,项目名称:ais,代码行数:5,代码来源:RelayCommand.cs

示例12: DelegateAuthenticator

 /// <summary>
 /// Creates a new DelegateAuthenticator.
 /// </summary>
 /// <param name="modifyRequest">Delegate used to modify the webrequest.</param>
 public DelegateAuthenticator(Action<HttpWebRequest> modifyRequest)
 {
     modifyRequest.ThrowIfNull("modifyRequest");
     ModifyRequestDelegate = modifyRequest;
 }
开发者ID:nick0816,项目名称:LoggenCSG,代码行数:9,代码来源:DelegateAuthenticator.cs

示例13: OnDisposeAction

        /// <summary>
        /// Initializes a new instance of the <see cref="Disposable"/> class.
        /// </summary>
        /// <param name="action">The action.</param>
        public OnDisposeAction(Action action)
        {
            action.ThrowIfNull("action");

            Action = action;
        }
开发者ID:liquidsnk,项目名称:Aspid,代码行数:10,代码来源:OnDisposeAction.cs

示例14: Command

 public Command(Action<object> action, Predicate<object> canExecute)
 {
     this.action = action.ThrowIfNull("Command : action null");
     this.canExecute = canExecute.ThrowIfNull("Command : canExecute null");
 }
开发者ID:modulexcite,项目名称:SharpGraph,代码行数:5,代码来源:Command.cs

示例15: Command

 public Command(Action<object> action, Predicate<object> canExecute = null)
 {
     this.action = action.ThrowIfNull("Command : action null");
     this.canExecute = canExecute;
     this.isEnabled = true;
 }
开发者ID:Uwy,项目名称:0x2eNEET,代码行数:6,代码来源:Command.cs


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