Shows how to use hashtable alias.
#include <xtd/collections/hashtable>
#include <xtd/console>
auto main() -> int {
open_with["txt"] = "notepad.exe";
open_with["bmp"] = "paint.exe";
open_with["dib"] = "paint.exe";
open_with["rtf"] = "wordpad.exe";
console::write_line("For key = \"rtf\", value = {0}.", open_with["rtf"]);
open_with["rtf"] = "winword.exe";
console::write_line("For key = \"rtf\", value = {0}.", open_with["rtf"]);
open_with["doc"] = "winword.exe";
if (!open_with.contains("ht")) {
open_with["ht"] = "hypertrm.exe";
console::write_line("Value added for key = \"ht\": {0}", open_with["ht"]);
}
console::write_line();
for (auto de : open_with)
console::write_line("Key = {0}, Value = {1}", de.first, de.second);
console::write_line("\nerase(\"doc\")");
open_with.erase("doc");
if (!open_with.contains("doc"))
console::write_line("Key \"doc\" is not found.");
}
generic::dictionary< xtd::any_object, xtd::any_object > hashtable
Represents a collection of key/value pairs that are organized based on the hash code of the key.
Definition hashtable.hpp:47
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10