c# - How to create a Generic Dictionary? -


I have a class where I have a dictionary containing a specific key. But the value should be normal.

Something like this:

  Private dictionary & lt; String, TLL & gt; _dictionary;   

But TVWall (reliably) is not found, but what else should I be kept? I found a solution for ILID but I just want to add the one generic object.

So you want a common dictionary? Use pre-defined classes.

  public dictionary & lt; Int, string & gt; _dictionary = New Dictionary & lt; Int, string & gt; ();   

This gives you a dictionary with an integer key, and returns a string value. If you need a dictionary with only one value, then you can get the dictionary to create your own type.

  Public class KeytipConstantEXen & lt; T & gt; : Dictionary & lt; Int, T & gt; {}   

Then it is the same to use:

  KeyTypeConstantDictionary & lt; String & gt; X = new keytepe constant dictator & lt; String & gt; (); // Similar to dictionary & lt; Int, string & gt; () Keytepe Constant Edition & lt; SomeObject & gt; X = new keytepe constant dentist & lt; Some objects & gt; (); // Similar to dictionary & lt; Int, SomeObject & gt; ()   

Hopefully I understood your question correctly.

Comments