How to automatically generate a new int with a specific name?

Hello!

I need to automatically generate an int with a specific name taken from PlayerPrefs. Here’s the idea:

//create the int
void CreateInt()
{
    new int PlayerPrefs.GetString("WhatToNameTheInt");
}

Obviously that code won’t work. I’ve solved much harder C# issues, but this seemingly simply concept is bugging me…

Thanks for your ideas!

@ChrisAngelMindmapfreak I can’t reply to you either :confused:

I’ve never used C# dictionaries before… I’ll give it a shot as this quick example that Bing gave me seems to be close to what I need:

using System;
using System.Collections.Generic;

namespace DictionaryTest {
    public class Solution {
        static void Main(String[] args) {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            // Add values in different ways
            dictionary.Add("Key1", "Value1");
            dictionary["Key2"] = "Value2";
            
            int size = dictionary.Count;
            string key1Value = dictionary["Key1"];
            string key2Value = dictionary["Key2"];
            bool containsKey3 = dictionary.ContainsKey("Key3");
            
            Console.WriteLine("Dictionary size: " + size);
            Console.WriteLine("Key 1 value: " + key1Value);
            Console.WriteLine("Key 2 value: " + key2Value);
            Console.WriteLine("Does Key3 exist? " + containsKey3);
        }
    }
}

Hopefully I’ll be able to figure this out on my own, thanks!