Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Collections.Generic;
- public class MyClass
- {
- public static void RunSnippet()
- {
- var dict = USStates.GetStates;
- foreach(var key in dict.Keys)
- {
- var val = dict[key];
- Console.WriteLine("{0} = {1}",key,val);
- }
- }
- #region Helper methods
- public static void Main()
- {
- try
- {
- RunSnippet();
- }
- catch (Exception e)
- {
- string error = string.Format("---\nThe following error occurred while executing the snippet:\n{0}\n---", e.ToString());
- Console.WriteLine(error);
- }
- finally
- {
- Console.Write("Press any key to continue...");
- Console.ReadKey();
- }
- }
- private static void WL(object text, params object[] args)
- {
- Console.WriteLine(text.ToString(), args);
- }
- private static void RL()
- {
- Console.ReadLine();
- }
- private static void Break()
- {
- System.Diagnostics.Debugger.Break();
- }
- #endregion
- }
- public class USStates
- {
- readonly static Dictionary<string, string> dictionary = null;
- public static Dictionary<string, string> GetStates
- {
- get { return dictionary; }
- }
- static USStates()
- {
- dictionary = new Dictionary<string, string>();
- dictionary["AL"] = "Alabama";
- dictionary["AK"] = "Alaska";
- dictionary["AZ"] = "Arizona";
- dictionary["AR"] = "Arkansas";
- dictionary["CA"] = "California";
- dictionary["CO"] = "Colorado";
- dictionary["CT"] = "Connecticut";
- dictionary["DE"] = "Delaware";
- dictionary["DC"] = "District";
- dictionary["FL"] = "Florida";
- dictionary["GA"] = "Georgia";
- dictionary["HI"] = "Hawaii";
- dictionary["ID"] = "Idaho";
- dictionary["IL"] = "Illinois";
- dictionary["IN"] = "Indiana";
- dictionary["IA"] = "Iowa";
- dictionary["KS"] = "Kansas";
- dictionary["KY"] = "Kentucky";
- dictionary["LA"] = "Louisiana";
- dictionary["ME"] = "Maine";
- dictionary["MT"] = "Montana";
- dictionary["NE"] = "Nebraska";
- dictionary["NV"] = "Nevada";
- dictionary["NH"] = "New";
- dictionary["NJ"] = "New";
- dictionary["NM"] = "New";
- dictionary["NY"] = "New";
- dictionary["NC"] = "North";
- dictionary["ND"] = "North";
- dictionary["OH"] = "Ohio";
- dictionary["OK"] = "Oklahoma";
- dictionary["OR"] = "Oregon";
- dictionary["MD"] = "Maryland";
- dictionary["MA"] = "Massachusetts";
- dictionary["MI"] = "Michigan";
- dictionary["MN"] = "Minnesota";
- dictionary["MS"] = "Mississippi";
- dictionary["MO"] = "Missouri";
- dictionary["PA"] = "Pennsylvania";
- dictionary["RI"] = "Rhode";
- dictionary["SC"] = "South";
- dictionary["SD"] = "South";
- dictionary["TN"] = "Tennessee";
- dictionary["TX"] = "Texas";
- dictionary["UT"] = "Utah";
- dictionary["VT"] = "Vermont";
- dictionary["VA"] = "Virginia";
- dictionary["WA"] = "Washington";
- dictionary["WV"] = "West";
- dictionary["WI"] = "Wisconsin";
- dictionary["WY"] = "Wyoming";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment