Xamarin.android 设置什么';发送方';在一般信息中

Xamarin.android 设置什么';发送方';在一般信息中,xamarin.android,Xamarin.android,我在我的Mono For Android应用程序中成功地使用了[TinyMessenger][1],并从GenericTinyMessage中提取了我的消息分类,以便我可以用它们发送内容 GenericTinyMessage需要将发件人传递给构造函数,如wiki中所述: // And if your message needs some "content" we provide a simple // generic message (GenericTinyMessage<TContent

我在我的Mono For Android应用程序中成功地使用了[TinyMessenger][1],并从GenericTinyMessage中提取了我的消息分类,以便我可以用它们发送内容

GenericTinyMessage需要将发件人传递给构造函数,如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
    }
}
//如果您的邮件需要一些“内容”,我们将提供一个简单的
//通用消息(GenericTinyMessage)开箱即用。
//
//我们可以直接使用这条信息,也可以从中派生出一条信息,从而获得一个
//强类型“内容”属性
公共类mymessage:genericinymessage
{
/// 
///创建MyMessageReach类的新实例。
/// 
///消息发送者(通常为“this”)
///电文内容
再次公开MyMessage(对象发送者,字符串内容)
:base(发件人、内容)
{
//我们现在有一个名为Content的公共字符串属性
}
}
然而,我是从一个静态类中使用它的,所以对于发送者来说没有这个。我可以使用null,还是必须提供发送对象

谢谢


James

静态类的常见用法是传入类型,即
typeof(MyStaticClass)
,但最终取决于用户。谢谢-正如你所说,它确实取决于库,不是吗?检查TinyMessenger的代码,如果我提供null,它会抱怨,因此typeof(MyStaticClass)看起来是个不错的选择。