Load it once, keep the value around somewhere. Hook into the
NSNotificationCenter event for changes.

OR

Just load it each time :) I suspect it's kept cached in memory anyway.

Depending on your existing design patterns... However, I'd do this as a
minimum:

public static string CurrentVersion                {
     get                        {                                using
(NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults) {
                                  return defaults.StringForKey
("appversion") ?? "1.0";                                }
          }                        set                        {
                        using (NSUserDefaults defaults =
NSUserDefaults.StandardUserDefaults) {
       defaults.SetString(AppVersion, "appversion");

defaults.Synchronize();                                }
         }                }


ie, make sure the using it around it to clean up nicely afterwards!



On Wed, Jul 18, 2012 at 6:44 PM, Mike Murdock <mmurd...@allmeds.com> wrote:

>  ** **
>
> I have multiple web service calling classes that have the same parameters
> stored in the NSUserDefaults. What is the best practice for performance in
> reading from the NSUserDefaults or should I do a appdelegte shared
> application type call.****
>
> ** **
>
> Thanks****
>
> ** **
>
> ** **
>
> *Michael Murdock *
> *Software Engineer*
>
> (865) 482-1999
> (865) 481-0921 fax
> www.allmeds.com****
>
> ** **
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>


-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop.
http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding!
http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to