migueldeicaza / MonoTouch.Dialog

Tools to simplify creating dialogs with the user using MonoTouch
MIT License
431 stars 211 forks source link

Add a object or string Tag field to Element base class to allow to set user defined data #135

Closed kowsari closed 12 years ago

kowsari commented 12 years ago

It would be nice to have a Tag field in the Element class so that we can associate user defined data (such as database IDs) to each Entry. You also need to add a function to Element class to traverse the elements and find the object with the given tag.

migueldeicaza commented 12 years ago

Hello Koussari,

The problem with adding a Tag to the base element class is that everyone will end up paying the memory price for this new field. I tried to keep the Element class as lightweight as possible for that reason.

What you can do, if you need to associate data in this way, is to keep a Dictionary with a mapping frmo your elements to your data.