2021-02-26

how to create a dictionairy with objects

I want to create a dictionairy of objects. It needs to be something with a key and a value.

 class Program
{
    static void Main(string[] args)
    {
        Dictionary<string, Object> listOfObjects = new Dictionary<string, Object>();
        listOfObjects.Add(1, new Object(1,"text"));
    }
}
class Object
{
    int integer;
    string line;
    Object()
    {
    }
    Object(int integer, string line)
    {
        this.integer = integer;
        this.line = line;
    }

}


from Recent Questions - Stack Overflow https://ift.tt/3pVigdO
https://ift.tt/eA8V8J

No comments:

Post a Comment