我在我的Mono For Android应用程序中成功使用[TinyMessenger] [1],并从GenericTinyMessage中获取我的消息,以便我可以用它们发送内容。
GenericTinyMessage需要将一个Sender传递给构造函数,如wiki所述:
// And if your message needs some "content" we provide a simple
// generic message (GenericTinyMessage<TContent>) out of the box.
//
// We can use that message directly or derive from it to gain a
// strongly typed "content" property
public class MyMessageAgain : GenericTinyMessage<String>
{
/// <summary>
/// Create a new instance of the MyMessageAgain class.
/// </summary>
/// <param name="sender">Message sender (usually "this")</param>
/// <param name="content">Contents of the message</param>
public MyMessageAgain(object sender, String content)
: base(sender, content)
{
// We now have a public string property called Content
}
}
但是,我在静态类中使用它,因此 我可以使用 null ,还是必须提供发送对象?
谢谢,
詹姆斯