c# - Exposing items in a ListBox through an Interface in MVP -
in mvp
application presenter wants access / update data in list box on view
. , presenter
talking view
through interface iview
. i'm planing expose items in list box through property follows. have problem in using single property in case.
interface iview { list<string> permission; } class form : iview { public list<string> permission { { return lstgivenpermissions; } // casting error set { lstgivenpermissions.datasource = value; } } }
so presenter
should able access , update data in list follows
class presenter { updatemodelfromview() { model.permission = view.permission; } updateviewfrommodel() { view.permission = model.permission; } }
my model
this
class model { ipublic list<string> permission = new list<string>(); // }
i know above code not compiled due mismatches in datatypes. (casting errors).
could please let me know how can achieve this?
i looking this...
public list<string> permission { { return lstgivenpermissions.items.cast<string>().tolist(); } // set { lstgivenpermissions.datasource = value; } }
and solved problem!!!
Comments
Post a Comment