How i can pass nullable value to a method
[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();
}
}
Thanks
Here you are assuming that obj is null when you start the async download, and that someway it’s no more null when DownloadCompleted is triggered. Is there something that you didn’t show that guarantee you this condition is satisfied? What are you doing after DownloadAsync, and how can you be sure that this will be evaluated before the completion of the download?