There is a project from several files. In file A a type synonym is declared, for example:
using MyMap = Dictionary<int, string>; There is also a function that uses this type as a parameter or / and return value. Suppose this:
public MyMap foo(MyMap map) { ... } Because the function is declared as public it is accessible from the outside, i.e. including from another file. However, due to the fact that the synonym of the type ( using ) can be used only within one file, the following solutions are obtained:
- Use the original type in file
B, i.e.Dictionary<int, string>; - Add similar
usingto fileB; - To refuse
usingand to make a full-fledged classMyMap(ie a wrapper over the dictionary).
Each approach has its pros and cons. I would like to understand which is more appropriate and why.
Maybe the problem should be solved differently (your option)?
Dictionary<int, string>, but aggregate it. That is, for my taste, a class with a (private) field of typeDictionary<int, string>. - VladDusing MyMap = Dictionary<int, string>;afternamespace XXX- Terrible