2

When I register the views models I do

SimpleIoc.Default.Register(
    () => SimpleIoc.Default.GetInstanceWithoutCaching<INewsViewModel>(),
    flow.Guid.ToString());

ViewModelsCache.Instance.AddViewModelInfo(flow.Guid.ToString(), INewsViewModel);

After I logout I am trying to do:

foreach (var viewModelInfo in ViewModelsCache.Instance.ViewModelsInfo)
{
    Type type = viewModelInfo.Value.GetType();             
    SimpleIoc.Default.Unregister<type>(viewModelInfo.key);
}

But I am getting the error:

'type' is a variable but is used like a type

Do you have an alternative suggestion?

Nicolas
  • 6,289
  • 4
  • 36
  • 51
MobileDev
  • 21
  • 1
  • 1
    I'm wondering why do you want to unregister ViewModels? Otherwise, you can find the answer for your question -> http://stackoverflow.com/questions/1408120/how-to-call-generic-method-with-a-given-type-object – EvZ Mar 20 '17 at 19:31

1 Answers1

0

What about to unregister all the instances?

SimpleIoc.Default.Reset();
Nicolas
  • 6,289
  • 4
  • 36
  • 51