amrods
amrods

Reputation: 2131

Array of object fields

How can I get an array with all the fields of an object? Suppose I have an object obj with fields a and b, I want to get an array with all the fields [:a, :b].

Upvotes: 0

Views: 58

Answers (1)

Toivo Henningsson
Toivo Henningsson

Reputation: 2709

You can use fieldnames(obj). See http://docs.julialang.org/en/latest/stdlib/base/#Base.fieldnames.

Upvotes: 4

Related Questions