dxml icon indicating copy to clipboard operation
dxml copied to clipboard

need a shorter way to reach attributes of Entities.

Open aferust opened this issue 5 years ago • 1 comments

It would be nice if we could access the attributes like:

string id = entity.attributes!"id"; or entity.attributes["id"];

please forgive me for my ignorance in advance, if I missed an existing feature. Only way I can do is looping over entire attributes.

aferust avatar Sep 14 '19 22:09 aferust

attributes returns a range, so you can use std.alorgithm's find - e.g. something like

auto id = entity.attributes.find!(a => a.name == "id")();

jmdavis avatar Sep 14 '19 23:09 jmdavis