Forum General

How data can be passed between controllers more efficiently

SumithPSSumithPS USMember

Hi,
I am new to Xamarin+c#, working on a project which uses MVC+Xamarin+C#. I have a controller which will collect the required data which can be used for another screen too. While I am in the second screen, how can I access this data in more efficient way or how can I pass the data from first controller to the second controller?

Answers

  • If you are talking about Xamarin.ios, you can create a public property in the destination view controller and assign them the required values just before you transit to it(mostly in PrepareForSegue overriden method.)

  • JohnHJohnH GBMember ✭✭✭✭✭

    Personally I would create a model class that contains properties for the information you want to send, and assign an instance of that model to your controller.

Sign In or Register to comment.