title: How can I access my settings.settings names arbitrarily?
body: <p>Finding this one hard to explain...</p>
  
  <p>I am storing around 80 settings in usersettings, the majority of which are stored as ints.</p>
  
  <p>I am in the process of rewriting a pre-existing program to implement MVVM, and whilst I could just pull the current code out and put it where it needs to go etc, I know there is a better way of handling this but am unsure how to do so.</p>
  
  <p>I will leave a sample of some code working with many oif these settings... I think I need a something which can take a parameter, and form the name of the setting based on the attribute given... </p>
  
  <p>This is some of the code... Instead of repeating the same code over and over again, I want some way of doing this a totally different way?</p>
  
  <pre><code>Regex overallRgx = new Regex(@"(?:.+?\n){0}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase); //These statements regex out the rank, level and xp.
  Match overallStats = overallRgx.Match(str);
  Regex attackRgx = new Regex(@"(?:.+?\n){1}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match attackStats = attackRgx.Match(str);
  Regex defenceRgx = new Regex(@"(?:.+?\n){2}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match defenceStats = defenceRgx.Match(str);
  Regex strengthRgx = new Regex(@"(?:.+?\n){3}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match strengthStats = strengthRgx.Match(str);
  Regex constitutionRgx = new Regex(@"(?:.+?\n){4}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match constitutionStats = constitutionRgx.Match(str);
  Regex rangeRgx = new Regex(@"(?:.+?\n){5}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match rangeStats = rangeRgx.Match(str);
  Regex prayerRgx = new Regex(@"(?:.+?\n){6}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match prayerStats = prayerRgx.Match(str);
  Regex magicRgx = new Regex(@"(?:.+?\n){7}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match magicStats = magicRgx.Match(str);
  Regex cookingRgx = new Regex(@"(?:.+?\n){8}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match cookingStats = cookingRgx.Match(str);
  Regex woodcuttingRgx = new Regex(@"(?:.+?\n){9}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match woodcuttingStats = woodcuttingRgx.Match(str);
  Regex fletchingRgx = new Regex(@"(?:.+?\n){10}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match fletchingStats = fletchingRgx.Match(str);
  Regex fishingRgx = new Regex(@"(?:.+?\n){11}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match fishingStats = fishingRgx.Match(str);
  Regex firemakingRgx = new Regex(@"(?:.+?\n){12}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match firemakingStats = firemakingRgx.Match(str);
  Regex craftingRgx = new Regex(@"(?:.+?\n){13}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match craftingStats = craftingRgx.Match(str);
  Regex smithingRgx = new Regex(@"(?:.+?\n){14}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match smithingStats = smithingRgx.Match(str);
  Regex miningRgx = new Regex(@"(?:.+?\n){15}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match miningStats = miningRgx.Match(str);
  Regex herbloreRgx = new Regex(@"(?:.+?\n){16}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match herbloreStats = herbloreRgx.Match(str);
  Regex agilityRgx = new Regex(@"(?:.+?\n){17}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match agilityStats = agilityRgx.Match(str);
  Regex thievingRgx = new Regex(@"(?:.+?\n){18}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match thievingStats = thievingRgx.Match(str);
  Regex slayerRgx = new Regex(@"(?:.+?\n){19}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match slayerStats = slayerRgx.Match(str);
  Regex farmingRgx = new Regex(@"(?:.+?\n){20}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match farmingStats = farmingRgx.Match(str);
  Regex runecraftingRgx = new Regex(@"(?:.+?\n){21}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match runecraftingStats = runecraftingRgx.Match(str);
  Regex hunterRgx = new Regex(@"(?:.+?\n){22}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match hunterStats = hunterRgx.Match(str);
  Regex constructionRgx = new Regex(@"(?:.+?\n){23}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match constructionStats = constructionRgx.Match(str);
  Regex summoningRgx = new Regex(@"(?:.+?\n){24}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match summoningStats = summoningRgx.Match(str);
  Regex dungeoneeringRgx = new Regex(@"(?:.+?\n){25}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match dungeoneeringStats = dungeoneeringRgx.Match(str);
  Regex divinationRgx = new Regex(@"(?:.+?\n){26}(-?\d+)\,(-?\d+)\,(-?\d+)[\s\S]*", RegexOptions.IgnoreCase);
  Match divinationStats = divinationRgx.Match(str);
  
  Properties.Settings.Default.SettUsername = DisplayName.Text;
  
  Properties.Settings.Default.SettOverallRank = Convert.ToInt32(overallStats.Groups[1].Value);
  Properties.Settings.Default.SettOverall = Convert.ToInt32(overallStats.Groups[2].Value);
  Properties.Settings.Default.SettOverallXP = Convert.ToString(overallStats.Groups[3].Value);
  
  Properties.Settings.Default.SettAttackRank = Convert.ToInt32(attackStats.Groups[1].Value);
  Properties.Settings.Default.SettAttack = Convert.ToInt32(attackStats.Groups[2].Value);
  Properties.Settings.Default.SettAttackXP = Convert.ToInt32(attackStats.Groups[3].Value);
  
  Properties.Settings.Default.SettDefenceRank = Convert.ToInt32(defenceStats.Groups[1].Value);
  Properties.Settings.Default.SettDefence = Convert.ToInt32(defenceStats.Groups[2].Value);
  Properties.Settings.Default.SettDefenceXP = Convert.ToInt32(defenceStats.Groups[3].Value);
  
  Properties.Settings.Default.SettStrengthRank = Convert.ToInt32(strengthStats.Groups[1].Value);
  Properties.Settings.Default.SettStrength = Convert.ToInt32(strengthStats.Groups[2].Value);
  Properties.Settings.Default.SettStrengthXP = Convert.ToInt32(strengthStats.Groups[3].Value);
  
  Properties.Settings.Default.SettConstitutionRank = Convert.ToInt32(constitutionStats.Groups[1].Value);
  Properties.Settings.Default.SettConstitution = Convert.ToInt32(constitutionStats.Groups[2].Value);
  Properties.Settings.Default.SettConstitutionXP = Convert.ToInt32(constitutionStats.Groups[3].Value);
  
  Properties.Settings.Default.SettRangeRank = Convert.ToInt32(rangeStats.Groups[1].Value);
  Properties.Settings.Default.SettRange = Convert.ToInt32(rangeStats.Groups[2].Value);
  Properties.Settings.Default.SettRangeXP = Convert.ToInt32(rangeStats.Groups[3].Value);
  
  Properties.Settings.Default.SettPrayerRank = Convert.ToInt32(prayerStats.Groups[1].Value);
  Properties.Settings.Default.SettPrayer = Convert.ToInt32(prayerStats.Groups[2].Value);
  Properties.Settings.Default.SettPrayerXP = Convert.ToInt32(prayerStats.Groups[3].Value);
  
  Properties.Settings.Default.SettMagicRank = Convert.ToInt32(magicStats.Groups[1].Value);
  Properties.Settings.Default.SettMagic = Convert.ToInt32(magicStats.Groups[2].Value);
  Properties.Settings.Default.SettMagicXP = Convert.ToInt32(magicStats.Groups[3].Value);
  
  Properties.Settings.Default.SettCookingRank = Convert.ToInt32(cookingStats.Groups[1].Value);
  Properties.Settings.Default.SettCooking = Convert.ToInt32(cookingStats.Groups[2].Value);
  Properties.Settings.Default.SettCookingXP = Convert.ToInt32(cookingStats.Groups[3].Value);
  
  Properties.Settings.Default.SettWoodcuttingRank = Convert.ToInt32(woodcuttingStats.Groups[1].Value);
  Properties.Settings.Default.SettWoodcutting = Convert.ToInt32(woodcuttingStats.Groups[2].Value);
  Properties.Settings.Default.SettWoodcuttingXP = Convert.ToInt32(woodcuttingStats.Groups[3].Value);
  
  Properties.Settings.Default.SettFletchingRank = Convert.ToInt32(fletchingStats.Groups[1].Value);
  Properties.Settings.Default.SettFletching = Convert.ToInt32(fletchingStats.Groups[2].Value);
  Properties.Settings.Default.SettFletchingXP = Convert.ToInt32(fletchingStats.Groups[3].Value);
  
  Properties.Settings.Default.SettFishingRank = Convert.ToInt32(fishingStats.Groups[1].Value);
  Properties.Settings.Default.SettFishing = Convert.ToInt32(fishingStats.Groups[2].Value);
  Properties.Settings.Default.SettFishingXP = Convert.ToInt32(fishingStats.Groups[3].Value);
  
  Properties.Settings.Default.SettFiremakingRank = Convert.ToInt32(firemakingStats.Groups[1].Value);
  Properties.Settings.Default.SettFiremaking = Convert.ToInt32(firemakingStats.Groups[2].Value);
  Properties.Settings.Default.SettFiremakingXP = Convert.ToInt32(firemakingStats.Groups[3].Value);
  
  Properties.Settings.Default.SettCraftingRank = Convert.ToInt32(craftingStats.Groups[1].Value);
  Properties.Settings.Default.SettCrafting = Convert.ToInt32(craftingStats.Groups[2].Value);
  Properties.Settings.Default.SettCraftingXP = Convert.ToInt32(craftingStats.Groups[3].Value);
  
  Properties.Settings.Default.SettSmithingRank = Convert.ToInt32(smithingStats.Groups[1].Value);
  Properties.Settings.Default.SettSmithing = Convert.ToInt32(smithingStats.Groups[2].Value);
  Properties.Settings.Default.SettSmithingXP = Convert.ToInt32(smithingStats.Groups[3].Value);
  
  Properties.Settings.Default.SettMiningRank = Convert.ToInt32(miningStats.Groups[1].Value);
  Properties.Settings.Default.SettMining = Convert.ToInt32(miningStats.Groups[2].Value);
  Properties.Settings.Default.SettMiningXP = Convert.ToInt32(miningStats.Groups[3].Value);
  
  Properties.Settings.Default.SettHerbloreRank = Convert.ToInt32(herbloreStats.Groups[1].Value);
  Properties.Settings.Default.SettHerblore = Convert.ToInt32(herbloreStats.Groups[2].Value);
  Properties.Settings.Default.SettHerbloreXP = Convert.ToInt32(herbloreStats.Groups[3].Value);
  
  Properties.Settings.Default.SettAgilityRank = Convert.ToInt32(agilityStats.Groups[1].Value);
  Properties.Settings.Default.SettAgility = Convert.ToInt32(agilityStats.Groups[2].Value);
  Properties.Settings.Default.SettAgilityXP = Convert.ToInt32(agilityStats.Groups[3].Value);
  
  Properties.Settings.Default.SettThievingRank = Convert.ToInt32(thievingStats.Groups[1].Value);
  Properties.Settings.Default.SettThieving = Convert.ToInt32(thievingStats.Groups[2].Value);
  Properties.Settings.Default.SettThievingXP = Convert.ToInt32(thievingStats.Groups[3].Value);
  
  Properties.Settings.Default.SettSlayerRank = Convert.ToInt32(slayerStats.Groups[1].Value);
  Properties.Settings.Default.SettSlayer = Convert.ToInt32(slayerStats.Groups[2].Value);
  Properties.Settings.Default.SettSlayerXP = Convert.ToInt32(slayerStats.Groups[3].Value);
  
  Properties.Settings.Default.SettFarmingRank = Convert.ToInt32(farmingStats.Groups[1].Value);
  Properties.Settings.Default.SettFarming = Convert.ToInt32(farmingStats.Groups[2].Value);
  Properties.Settings.Default.SettFarmingXP = Convert.ToInt32(farmingStats.Groups[3].Value);
  
  Properties.Settings.Default.SettRunecraftingRank = Convert.ToInt32(runecraftingStats.Groups[1].Value);
  Properties.Settings.Default.SettRunecrafting = Convert.ToInt32(runecraftingStats.Groups[2].Value);
  Properties.Settings.Default.SettRunecraftingXP = Convert.ToInt32(runecraftingStats.Groups[3].Value);
  
  Properties.Settings.Default.SettHunterRank = Convert.ToInt32(hunterStats.Groups[1].Value);
  Properties.Settings.Default.SettHunter = Convert.ToInt32(hunterStats.Groups[2].Value);
  Properties.Settings.Default.SettHunterXP = Convert.ToInt32(hunterStats.Groups[3].Value);
  
  Properties.Settings.Default.SettConstructionRank = Convert.ToInt32(constructionStats.Groups[1].Value);
  Properties.Settings.Default.SettConstruction = Convert.ToInt32(constructionStats.Groups[2].Value);
  Properties.Settings.Default.SettConstructionXP = Convert.ToInt32(constructionStats.Groups[3].Value);
  
  Properties.Settings.Default.SettSummoningRank = Convert.ToInt32(summoningStats.Groups[1].Value);
  Properties.Settings.Default.SettSummoning = Convert.ToInt32(summoningStats.Groups[2].Value);
  Properties.Settings.Default.SettSummoningXP = Convert.ToInt32(summoningStats.Groups[3].Value);
  
  Properties.Settings.Default.SettDungeoneeringRank = Convert.ToInt32(dungeoneeringStats.Groups[1].Value);
  Properties.Settings.Default.SettDungeoneering = Convert.ToInt32(dungeoneeringStats.Groups[2].Value);
  Properties.Settings.Default.SettDungeoneeringXP = Convert.ToInt32(dungeoneeringStats.Groups[3].Value);
  
  Properties.Settings.Default.SettDivinationRank = Convert.ToInt32(divinationStats.Groups[1].Value);
  Properties.Settings.Default.SettDivination = Convert.ToInt32(divinationStats.Groups[2].Value);
  Properties.Settings.Default.SettDivinationXP = Convert.ToInt32(divinationStats.Groups[3].Value);
  </code></pre>
  
  <p>Also, used again to set text places (this will need to change to databinding now of course)</p>
  
  <pre><code>switch (skill)
  {
      case "Overall":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettOverallRank);
          SkillXP.Text = String.Format("{0:n0}", Convert.ToInt64(Properties.Settings.Default.SettOverallXP));
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (Convert.ToInt64(exp[i]) &lt; Convert.ToInt64(Properties.Settings.Default.SettOverallXP))
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = Convert.ToInt64(exp[nextLevel]) - Convert.ToInt64(Properties.Settings.Default.SettOverallXP);
          percent = Convert.ToInt64(Properties.Settings.Default.SettOverallXP) - Convert.ToInt64(exp[realLevel]);
          rank = Properties.Settings.Default.SettOverallRank;
          break;
  
      case "Attack":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettAttackRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettAttackXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettAttackXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettAttackXP;
          percent = Properties.Settings.Default.SettAttackXP - exp[realLevel];
          rank = Properties.Settings.Default.SettAttackRank;
          break;
  
      case "Defence":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettDefenceRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettDefenceXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettDefenceXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettDefenceXP;
          percent = Properties.Settings.Default.SettDefenceXP - exp[realLevel];
          rank = Properties.Settings.Default.SettDefenceRank;
          break;
  
      case "Strength":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettStrengthRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettStrengthXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettStrengthXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettStrengthXP;
          percent = Properties.Settings.Default.SettStrengthXP - exp[realLevel];
          rank = Properties.Settings.Default.SettStrengthRank;
          break;
  
      case "Constitution":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettConstitutionRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettConstitutionXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettConstitutionXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettConstitutionXP;
          percent = Properties.Settings.Default.SettConstitutionXP - exp[realLevel];
          rank = Properties.Settings.Default.SettConstitutionRank;
          break;
  
      case "Range":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettRangeRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettRangeXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettRangeXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettRangeXP;
          percent = Properties.Settings.Default.SettRangeXP - exp[realLevel];
          rank = Properties.Settings.Default.SettRangeRank;
          break;
  
      case "Prayer":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettPrayerRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettPrayerXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettPrayerXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettPrayerXP;
          percent = Properties.Settings.Default.SettPrayerXP - exp[realLevel];
          rank = Properties.Settings.Default.SettPrayerRank;
          break;
  
      case "Magic":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettMagicRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettMagicXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettMagicXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettMagicXP;
          percent = Properties.Settings.Default.SettMagicXP - exp[realLevel];
          rank = Properties.Settings.Default.SettMagicRank;
          break;
  
      case "Cooking":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettCookingRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettCookingXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettCookingXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettCookingXP;
          percent = Properties.Settings.Default.SettCookingXP - exp[realLevel];
          rank = Properties.Settings.Default.SettCookingRank;
          break;
  
      case "Woodcutting":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettWoodcuttingRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettWoodcuttingXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettWoodcuttingXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettWoodcuttingXP;
          percent = Properties.Settings.Default.SettWoodcuttingXP - exp[realLevel];
          rank = Properties.Settings.Default.SettWoodcuttingRank;
          break;
  
      case "Fletching":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettFletchingRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettFletchingXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettFletchingXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettFletchingXP;
          percent = Properties.Settings.Default.SettFletchingXP - exp[realLevel];
          rank = Properties.Settings.Default.SettFletchingRank;
          break;
  
      case "Fishing":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettFishingRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettFishingXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettFishingXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettFishingXP;
          percent = Properties.Settings.Default.SettFishingXP - exp[realLevel];
          rank = Properties.Settings.Default.SettFishingRank;
          break;
  
      case "Firemaking":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettFiremakingRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettFiremakingXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettFiremakingXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettFiremakingXP;
          percent = Properties.Settings.Default.SettFiremakingXP - exp[realLevel];
          rank = Properties.Settings.Default.SettFiremakingRank;
          break;
  
      case "Crafting":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettCraftingRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettCraftingXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettCraftingXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettCraftingXP;
          percent = Properties.Settings.Default.SettCraftingXP - exp[realLevel];
          rank = Properties.Settings.Default.SettCraftingRank;
          break;
  
      case "Smithing":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettSmithingRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettSmithingXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettSmithingXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettSmithingXP;
          percent = Properties.Settings.Default.SettSmithingXP - exp[realLevel];
          rank = Properties.Settings.Default.SettSmithingRank;
          break;
  
      case "Mining":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettMiningRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettMiningXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettMiningXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettMiningXP;
          percent = Properties.Settings.Default.SettMiningXP - exp[realLevel];
          rank = Properties.Settings.Default.SettMiningRank;
          break;
  
      case "Herblore":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettHerbloreRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettHerbloreXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettHerbloreXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettHerbloreXP;
          percent = Properties.Settings.Default.SettHerbloreXP - exp[realLevel];
          rank = Properties.Settings.Default.SettHerbloreRank;
          break;
  
      case "Agility":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettAgilityRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettAgilityXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettAgilityXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettAgilityXP;
          percent = Properties.Settings.Default.SettAgilityXP - exp[realLevel];
          rank = Properties.Settings.Default.SettAgilityRank;
          break;
  
      case "Thieving":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettThievingRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettThievingXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettThievingXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettThievingXP;
          percent = Properties.Settings.Default.SettThievingXP - exp[realLevel];
          rank = Properties.Settings.Default.SettThievingRank;
          break;
  
      case "Slayer":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettSlayerRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettSlayerXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettSlayerXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettSlayerXP;
          percent = Properties.Settings.Default.SettSlayerXP - exp[realLevel];
          rank = Properties.Settings.Default.SettSlayerRank;
          break;
  
      case "Farming":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettFarmingRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettFarmingXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettFarmingXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettFarmingXP;
          percent = Properties.Settings.Default.SettFarmingXP - exp[realLevel];
          rank = Properties.Settings.Default.SettFarmingRank;
          break;
  
      case "Runecrafting":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettRunecraftingRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettRunecraftingXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettRunecraftingXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettRunecraftingXP;
          percent = Properties.Settings.Default.SettRunecraftingXP - exp[realLevel];
          rank = Properties.Settings.Default.SettRunecraftingRank;
          break;
  
      case "Hunter":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettHunterRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettHunterXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettHunterXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettHunterXP;
          percent = Properties.Settings.Default.SettHunterXP - exp[realLevel];
          rank = Properties.Settings.Default.SettHunterRank;
          break;
  
      case "Construction":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettConstructionRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettConstructionXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettConstructionXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettConstructionXP;
          percent = Properties.Settings.Default.SettConstructionXP - exp[realLevel];
          rank = Properties.Settings.Default.SettConstructionRank;
          break;
  
      case "Summoning":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettSummoningRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettSummoningXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettSummoningXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettSummoningXP;
          percent = Properties.Settings.Default.SettSummoningXP - exp[realLevel];
          rank = Properties.Settings.Default.SettSummoningRank;
          break;
  
      case "Dungeoneering":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettDungeoneeringRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettDungeoneeringXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettDungeoneeringXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettDungeoneeringXP;
          percent = Properties.Settings.Default.SettDungeoneeringXP - exp[realLevel];
          rank = Properties.Settings.Default.SettDungeoneeringRank;
          break;
  
      case "Divination":
          SkillRank.Text = String.Format("{0:n0}", Properties.Settings.Default.SettDivinationRank);
          SkillXP.Text = String.Format("{0:n0}", Properties.Settings.Default.SettDivinationXP);
  
          for (int i = 0; i &lt; 126; i++)
          {
              if (exp[i] &lt; Properties.Settings.Default.SettDivinationXP)
              {
                  realLevel = i;
              }
          }
          nextLevel = realLevel + 1;
          required = exp[nextLevel] - Properties.Settings.Default.SettDivinationXP;
          percent = Properties.Settings.Default.SettDivinationXP - exp[realLevel];
          rank = Properties.Settings.Default.SettDivinationRank;
          break;
  
      default:
          exp[0] = 3;
          realLevel = 1;
          percent = 1;
          break;
  }
  </code></pre>
  
  <p>So essentially... Would there be a way that I could pass a parameter somewhere, of say "Attack" and it would do what it needs to do with attack everywhere... Then pass a parameter of "Defence" and it does what it needs to do etc... It would be cool if there was a way, for example of doing this:</p>
  
  <pre><code>string str = "attack";
  Properties.Settings.Default. + str  = "blah";
  </code></pre>