本文整理汇总了C#中IMessage.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# IMessage.ThrowIfNull方法的具体用法?C# IMessage.ThrowIfNull怎么用?C# IMessage.ThrowIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMessage
的用法示例。
在下文中一共展示了IMessage.ThrowIfNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MessageFormatter
public MessageFormatter(IMessage message, SpriteFont font, WindowTexture selectedAnswerWindowTexture, float maximumLineWidth)
{
message.ThrowIfNull("message");
font.ThrowIfNull("font");
selectedAnswerWindowTexture.ThrowIfNull("selectedAnswerWindowTexture");
_font = font;
_selectedAnswerWindowTexture = selectedAnswerWindowTexture;
_maximumLineWidth = maximumLineWidth;
_spaceWord = new MessageTextWord(" ", font.MeasureString(" "), false);
ProcessMessageParts(message);
}
示例2: MessageClosed
public void MessageClosed(IMessage message)
{
message.ThrowIfNull("message");
var messageObject = message as Message;
var messageAnswerObject = message as MessageAnswer;
if (messageObject != null)
{
_worldInstance.RaiseEvent(messageObject.OnClosed, new MessageClosedEvent(messageObject));
}
else if (messageAnswerObject != null)
{
_worldInstance.RaiseEvent(messageAnswerObject.OnClosed, new MessageAnswerClosedEvent(messageAnswerObject));
}
}
示例3: EnqueueMessage
public void EnqueueMessage(IMessage message, MessageQueuePosition position)
{
message.ThrowIfNull("message");
switch (position)
{
case MessageQueuePosition.First:
_list.Insert(0, message);
break;
case MessageQueuePosition.Last:
_list.Add(message);
break;
default:
throw new ArgumentOutOfRangeException("position");
}
}