Quantcast
Channel: C# genrics
Viewing all articles
Browse latest Browse all 6

C# genrics

$
0
0
using arrays we persist either key or values of the dictionary, then how can we use array to persist both keys & values combinedly???

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      MyDictionaryElement[] MyDictionary = new MyDictionaryElement[10];
      MyDictionary[0] = new MyDictionaryElement() { Key = 0, Value = "Zerro" };
      //... and so on
    }
  }
  class MyDictionaryElement
  {
    public object Key { set; get; }
    public object Value { set; get; }
  }
}

Don't be stickler and wine with William Shakespeare after the solution :^)
"And this our life, exempt from public haunt, finds tongues in trees, books in the running brooks, sermons in stones, and good in everything." William Shakespeare

Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>