ToString() public méthode

public ToString ( ) : string
Résultat string
 public void CreateFromAnonymousObject()
 {
     var attributes = new HtmlAttributes(new {
             text = "some text",
             num = 123
         });
     Assert.AreEqual("num=\"123\" text=\"some text\"", attributes.ToString());
 }
 public void CreateFromDictionary()
 {
     var attributes = new HtmlAttributes(new Dictionary<string, object>
         {
             {"text", "some text"},
             {"num", 123}
         });
     Assert.AreEqual("num=\"123\" text=\"some text\"", attributes.ToString());
 }
 private void WriteOpening()
 {
     var navAttrs = new HtmlAttributes(new {@class = "navbar navbar-default", role = "navigation"});
     if (_settings.Fixed == FixedPosition.Top) navAttrs["class"] += "navbar-fixed-top";
     else if (_settings.Fixed == FixedPosition.Bottom) navAttrs["class"] += "navbar-fixed-bottom";
     if (_settings.Inverse) navAttrs["class"] += "navbar-inverse";
     Write("<nav {0}>", navAttrs.ToString());
     if (_settings.UseInnerContainer) Write("<div class=\"container\">");
 }
 private void WriteOpening()
 {
     var navAttrs = new HtmlAttributes(new { @class = "nav" });
     if (_settings.Style == NavStyle.Navbar) navAttrs["class"] += "navbar-nav";
     else navAttrs["class"] += "nav-" + _settings.Style.ToString().ToLower();
     if (_settings.Stacked) navAttrs["class"] += "nav-stacked";
     if (_settings.Justified) navAttrs["class"] += "nav-justified";
     if (_settings.NavbarRight) navAttrs["class"] += "navbar-right";
     Write("<ul {0}>", navAttrs.ToString());
 }
 public void OverwriteAttributes()
 {
     var attributes = new HtmlAttributes(new { text = "original" });
     attributes["text"] = "replacement";
     Assert.AreEqual("text=\"replacement\"", attributes.ToString());
 }
 public void AppendNonExistantAttributesSetsWithoutLeadingSpace()
 {
     var attributes = new HtmlAttributes(new { });
     attributes["text"] += "some words";
     Assert.AreEqual("text=\"some words\"", attributes.ToString());
 }
 public void AppendAttributesWithSpace()
 {
     var attributes = new HtmlAttributes(new { text = "original" });
     attributes["text"] += "replacement";
     Assert.AreEqual("text=\"original replacement\"", attributes.ToString());
 }