Collection.opIndex

Accesses a single collection entry.

struct Collection(I)
opIndex
if (
is(I == interface)
)

Examples

interface IMain {
	@property Collection!IItem items();
}

interface IItem {
	struct CollectionIndices {
		int _itemID;
	}

	@method(HTTPMethod.GET)
	string name(int _itemID);
}

void test(IMain main)
{
	auto item_name = main.items[23].name; // equivalent to IItem.name(23)
}

Meta