Just deduce IControl<T>from IControl.
public interface IControl<T> : IControl
{
T Value { get; }
}
UPDATE
If I missed you and you do not need a non-common interface, you will also have to use the method GetControl().
public IControl<T> GetControl<T>()
{
if (typeof(T) == typeof(Boolean))
{
return new BoolControl();
}
else if (typeof(T) == typeof(String))
{
return new StringControl();
}
else
{
return null;
}
}
, IControl<T>, .
public IControl<T> GetControl<T>()
{
if (typeof(T) == typeof(Boolean))
{
return new (IControl<T>)BoolControl();
}
else if (typeof(T) == typeof(String))
{
return (IControl<T>)new StringControl();
}
else
{
return null;
}
}
UPDATE
as IControl<T> (IControl<T>). , , , as IControl<T> null.