lundi 19 septembre 2016

Is there a dictionary type of object that contains two values instead of one?

I frequently use Dictionary types to store key and value pairs but I've been working with XML namespaces and need to store properties of the same name but may have different namespaces.

Is there a type of Dictionary that contains two values instead of one? What would it be called?

If something like this doesn't exist what would be a cool alternative?

Previous solved problem:

var defaultNamespace:String = "http://www.domain.com";
var attributes:Array = ["property1", "property2"];
var dictionary:Dictionary = new Dictionary();
dictionary["property1"] = defaultNamespace;
dictionary["property2"] = defaultNamespace;

New problem is properties with namespaces:

var defaultNamespace:String = "http://www.domain.com";
var namespace2:String = "library://ns.fl.com/fl";
var attributes:Array = ["property1", "library://ns.fl.com/fl::property1", "property2"];
var dictionary:Dictionary = new Dictionary();
dictionary["property1"] = {name:"property1",defaultNamespace};
dictionary["library://ns.fl.com/fl::property1"] = {name:"property1",namespace2};
dictionary["property2"] = {name:"property2",defaultNamespace};

I'd rather not create objects to contain two values.

Aucun commentaire:

Enregistrer un commentaire