wpf - What is the best C# collection with two keys and an object? -
I get a menu manager class in which each module can add a key and element the main content Can be loaded in:
Private dictionary & lt; String, Object & gt; _mainContentItems = New Dictionary & lt; String, Object & gt; (); Public dictionary & lt; String, Object & gt; {Get {return_mancontent items; main content item; } Set {_mainContentItems = value; }}
Then the customer module registers its ideas:
Layout Manager. Main content Add ("Customer Support", this.container.Resolve & lt; HelpView & gt; ()); Layout Manager Main content Add ("customer-main", this content. Resolve ());
Then again I say to bring a specific view of the front:
layoutManager.ShowMainContentView ("customer support"); To get the default view (first view registered), I say: layoutManager.ShowDefaultView ("customer");
And it works fine.
However, I want to eliminate the "code smell" from the hyphen, which separates the name and the visual name of the module, so I register with this command:
< Code> layout manager. Add ("Customer", "Help", this.container.Resolve & lt; Help View & gt; ());
But what is the best way to change my existing dictionary, e.g. What comes to mind is this:
-
Glossary & lt; String, String, Object & gt;
-
dictionary & lt; KeyvaluePair & lt; String, string & gt;, object & gt;
-
Dictionaries & lt; CUSTOM_STRUCT, Object & gt;
The new collection should be able to:
- Get a view with the module and the View key (like "Customer" / Li>
- Get a collection of all the views by the module key (like "Customer" returns 5 views)
dictionaries & lt; Use string, dictionary & lt; string, object & gt; & gt; ;
var dict = new dictionary & lt; string , Dictionary & lt; string, object & gt; & g T; (); ... object view = dict ["customer"] ["help"]; dictionary & lt; string, object & gt; .view visualization = word ["customer"]. Value;
Comments
Post a Comment