views:

47

answers:

1

Which is the better API? I think the latter approach is better because strings are interned. But I'm pining for succintness. Which do you think is better?

[Task("Assortment", Author = "好先生", MenuTree = "The>Quick>Brown>Megan")] public partial class Form1 : MycForm, ITaskPlugin { }

or this(strings can be interned):

[Task("Assortment", Author = "好先生", MenuTree = new string[] { "The", "Quick", "Brown", "Megan"} )] public partial class Form1 : MycForm, ITaskPlugin { }

+1  A: 

The array. Not only because strings can be interned, but because you don't have to parse it every time you need to work with it. I assume you'll actually be making a tree of menu objects from the string, so you'll want to sort and manipulate individual parts of the tree, not the whole thing at a time.

lc