CSharp · Console
using System;
using System.Collections.Generic;
public class Program
{
public class MyObject
{
public string Name {get; set;}
public string Value {get; set;}
public int Prop1 {get; set;}
public double Prop2 {get; set;}
public MyObject (string name, string valueParam, int prop1, double prop2)
{
this.Name = name;
this.Value = valueParam;
this.Prop1 = prop1;
this.Prop2 = prop2;
}
}
public static void Main()
{
Dictionary<string, MyObject> myObjectArray = new Dictionary<string, MyObject>();
myObjectArray.Add("Item1", new MyObject("item1", "valor1", 1, 1.1));
myObjectArray.Add("Item2", new MyObject("item2", "valor2", 2, 2.2));
myObjectArray.Add("Item3", new MyObject("item3", "valor3", 3, 3.3));
var dado = myObjectArray["Item1"];
Console.WriteLine(dado.Name);
}
}