Application Setting in VB and C#

Application setting can be user-scoped or application-scoped. The user scoped one can be read and write at runtime.For example, assign value Variabl1 to a user-scoped application setting will be like the following

VB:

My.Settings.Sample=Variable1

C#:

Properties.Settings.Default.Sample=Variable1;
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.Save();

The user.config file will be stored against the logged in user,

Windows XP:
C:\Documents and Settings\username\Local Settings\Application Data\companyname\Applicationname\application.exe$%^&*1.1.0.0

Vista:
C:\Users\username\AppData\Local\ApplicationName\application.exe@#$%^\1.1.0.0

Advertisements

DateTime.Now vs. DateTime.UtcNow

I was modifying customer support site today, and one of the change is to have NZ time displayed with sun/moon image. This may seem to be a useless thing to do since anyone has the browser would have the time showing on the right bottom corner of their screen (or right top if using mac). But if you have SMS linked to support site, you definitely don’t want to receive message in the middle of the night.

Anyway, I never realize there’s a UtcNow function, basically it’s the standard international time that all time zones are expressed as offsets of, it’s not offset to daylight saving. There’s also a getutcdate() in SQL Server verses getdate()

world time zone