title: How to fetch Item Key from Firebase
body: <p>I want to get the item key of my data in my database but in as you can see in DataSnapshot function, I call try to fetch the item key but it return empty. I am trying to bind all item keys to my data fetch. So every item fetched should have its key in it so I can use the key.  But then, all other elements are fetched excluding the item key. Why is the item key not showing? Thank you for your help </p>
  
  <p><strong>structure</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Faksp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Faksp.png" alt="enter image description here"></a></p>
  
  <p><strong>Model</strong></p>
  
  <pre><code> public Hero(string uid,string name, string achievment, string history, string quote)
              {
                  this.uid = uid;
                  this.name = name;
                  this.achvievment = achievment;
                  this.history = history;
                  this.quote = quote;
              }
  
  
          public HashMap ToMap()
          {
  
              HashMap map = new HashMap();
              map.Put("Uid", this.uid);
              map.Put("Name", this.name);
              map.Put("Achievement", this.achvievment);
              map.Put("History", this.history);
              map.Put("Quote", this.quote);
              return map;
          }
  
  
  
          public string Uid
  
          {
              get { return uid; }
              set { uid = value; }
          }
  
          public string Name
          {
              get { return name; }
              set { name = value; }
  
          }
  
          public int Image
  
          {
              get { return image; }
              set { image = value; }
  
          }
  
          public string Achievement 
  
          {
              get { return achvievment; }
              set { achvievment = value; }
          }
  
          public string History
  
          {
              get { return history; }
              set { history = value; }
          }
  
          public string Quote
  
          {
              get { return quote; }
              set { quote = value; }
          }
  </code></pre>
  
  <p><strong>Saving data</strong></p>
  
  <pre><code>//this is how i save my data which works fine
  
  
   mHero.Push().SetValue(new PeaceHero(user.Uid,HeroName.Text, HeroAchv.Text, HeroHistory.Text, HeroQuote.Text).ToMap());
  </code></pre>
  
  <p><strong>Fetching Data</strong></p>
  
  <pre><code>public void OnDataChange(DataSnapshot snapshot)
          {
              var items = snapshot.Children?.ToEnumerable&lt;DataSnapshot&gt;();
  
              HashMap map;
              foreach (DataSnapshot item in items)
              {
  
                  map = (HashMap)item.Value;
  
                  Hero.Add(new Hero(map.Get(item.Key)?.ToString(),map.Get("Name")?.ToString(), map.Get("Achievement")?.ToString(),map.Get("History")?.ToString(),map.Get("Quote")?.ToString()));
                  Console.WriteLine("Sending item key" +item.Key.ToString());
                  key = item.Key;
              }
  
              HeroAdapter adapter = new PeaceHeroAdapter(Hero,this);
  
              Console.Write("The key is "+key);
  
          }
  </code></pre>