Changeset 2810


Ignore:
Timestamp:
02/16/10 10:47:53 (11 years ago)
Author:
mkommend
Message:

updated MainFormManager to transform generic type definitions to concrete type if possible (ticket #857)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm/3.2/MainFormManager.cs

    r2790 r2810  
    136136      if (!typeof(IView).IsAssignableFrom(viewType))
    137137        throw new ArgumentException("View can not be created becaues given type " + viewType.ToString() + " is not of type IView.");
    138       if (viewType.IsGenericTypeDefinition)
    139         throw new ArgumentException("View can not be created becaues given type " + viewType.ToString() + " is a generic type definition.");
     138      Type view = viewType;
     139      if (view.IsGenericTypeDefinition)
     140        view = TransformGenericTypeDefinition(view, content.GetType());
    140141
    141       return (IView)Activator.CreateInstance(viewType, content);
     142      return (IView)Activator.CreateInstance(view, content);
    142143    }
    143144
Note: See TracChangeset for help on using the changeset viewer.