I am aware that it's not possible to alias a generic type (e.g. using Foo = Dictionary;
is invalid), but that the generic type on the right must be closed (e.g. using Foo = Dictionary<int, string>;
will work).
However, it seems like it's invalid to alias an IDictionary<string, object>
--instead, the alias must be for just the interface IDictionary
. The error I get is "CS0308: The non-generic type 'IDictionary' cannot be used with type arguments." Is there a way to alias this entire thing? (Or a better way to achieve what I want?)
A common thing I do in my API is for functions to take an IDictionary<string, object>
, and I'd like to do something akin to using ParsedObjects = IDictionary<string, object>;
. In fact, I'd like to be able to declare:
using ParsedObjectsHandler = Func<Interaction, object, IDictionary<string, object>, Task>;
(But I am willing to settle for just the former.)