如何传递空值的方法传递空值的方法
[Import("Default", typeof(ISomeInterface), AllowRecomposition = true, AllowDefault = true)]
public ISomeInterface x { get; set; }
// x is null till now
void DoWork(ISomeInterface obj) //Not working
{
if (obj == null)
{
//Download and Satisfy
DeploymentCatalog DC = new DeploymentCatalog("TheXAPfile.xap");
DC.DownloadCompleted += (s, e) =>
{
catalog.Catalogs.Add(f); //catalog is AggregateCatalog
obj.Show();
};
DC.DownloadAsync();
}
else
{
obj.Show();
}
}
由于
什么是不工作?你有一个实现'ISomeInterface'的值类型吗? – dlev
显示发生实际错误的代码部分以及它给出的消息(如果有),或者在编译器错误时显示编译器消息。 –
System.NullReferenceExcption:[Arg_NullRefrenceException] – MrBassam