Nanashi-soft○プログラマ専用○PSSuite開発○
using System.Collections; //Hashtableを使う為に必要
Hashtable a = new Hashtable();
Hashtable a = new Hashtable(); a["item1"] = "sword";
Hashtable a = new Hashtable(); try{ a.Add("item1", "shield"); }catch{ //既にある項目を追加しようとした }
Hashtable a = new Hashtable(); a.Remove("item1");
Hashtable a = new Hashtable(); a.Clear();
Hashtable a = new Hashtable(); string b; b = "" + a["item1"];
try{ b = (string)a["item1"]; }catch{ //変数の中身が文字では無い }
Hashtable a = new Hashtable(); a["item1"] = "sword"; a["kakaku1"] = 250; var work; string b; int c; work = ["item1"]; b = (string)work; work = ["kakaku1"]; c = (int)work;
Hashtable a = new Hashtable(); foreach (string key in a.Keys) { string work; work = "" + a[key]; }
Hashtable a = new Hashtable(); if(a.ContainsKey("koumoku")){ //存在する }else{ //存在しない }
Hashtable moto = new Hashtable(); Hashtable saki = new Hashtable(); moto.Add("item1", "sword"); saki = (Hashtable)moto.Clone();