title: Sensible way to output content of dictionary as valid html tags?
body: <p>I am trying to generate hreflang tags like so:</p>
  
  <pre><code>&lt;link hreflang="en-DE" rel="alternate" href="/en-DE" /&gt;
  </code></pre>
  
  <p>I currently am putting together my dictionary as below, and I thought I could use a 2nd foreach loop to generate the tags with the key value pairs:</p>
  
  <pre><code>public static IHtmlString HrefLangLinks(this PageData currentPage)
  {
  
      var hrefLangTags = string.Empty;
      var availablePageLanguages = currentPage.ExistingLanguages.Select(culture =&gt; culture.Name).ToArray();
  
      Dictionary&lt;string, string&gt; langs = new Dictionary&lt;string, string&gt;();
  
      var contentLoader = ServiceLocator.Current.GetInstance&lt;IContentLoader&gt;();
      var urlResolver = ServiceLocator.Current.GetInstance&lt;UrlResolver&gt;();
  
      foreach (string cultureName in availablePageLanguages)
      {  
          var culturePage = contentLoader.Get&lt;PageData&gt;(currentPage.ContentGuid, new LanguageSelector(cultureName));
          var culturePath = urlResolver.GetVirtualPath(culturePage.ContentLink, culturePage.Language.Name);
          langs.Add(cultureName, culturePath.GetUrl());
  
          foreach (KeyValuePair&lt;string, string&gt; entry in langs)
          {
              hrefLangTags += ("&lt;link hreflang=\"{0}\" rel=\"alternate\" href=\"{1}\" &gt;", langs.Keys, langs.Values);
  
          }
      }
  
      return new HtmlString(hrefLangTags);
  
  }
  </code></pre>
  
  <p>Is there a simple and elegant way to iterate through the dictionary and create my tags?</p>