No, basically. A static method in a nonequivalent class (such as DropDownControl [no>]) is the best approach since you should be able to use type inference when calling Create () - i.e.
var control = DropDownControl.Create(name, dictionary);
C # 3.0 helps here with both "var" (very welcome here) and with improved general type inference rules. In some (more general) cases, another similar option is the extension method, but the extension method for creating a very specific control from the dictionary is not very natural - I would use a method without extension.
Sort of:
public static class DropDownControl { public static DropDownControl<KeyValuePair<TKey,TValue>, TKey, TValue> Create<TKey,TValue>(IDictionary<TKey, TValue> value, string name) where TKey : IComparable { return new DropDownControl<KeyValuePair<TKey, TValue>, TKey, TValue> (name, value, pair => pair.Key, pair => pair.Value, key => value.ContainsKey(key) ); } }
Another option is inheritance, but I don't like it ...
public class DropDownControl<TKey, TValue> : DropDownControl<KeyValuePair<TKey, TValue>, TKey, TValue> where TKey : IComparable { public DropDownControl(IDictionary<TKey, TValue> lookup, string name) : base(name, lookup, pair => pair.Key, pair => pair.Value, key => lookup.ContainsKey(key)) { } }
This adds complexity and reduces your flexibility ... I would not do this ...
In general, it looks like you only want to work with IDictionary <,> - I wonder if you can simplify your control to just use this and force non-dictionary callers to wrap themselves in an IDictionary <,> facade?