c# - Holding a static int through software reboot -


i building department store management system project. managing range of objects , want have unique ids of them, no 2 objects have same id.

for purpose want hold int symbolizing last id used in program.

i know can't use static int resets when program restarts...

i thought saving disk on shut down seems not elegant me. , wanted ask, there better way store last id in way can use when software reboots?

thank you!

you can use .net settings store variable per appliction or per user.

1) go project properties -> settings , create new lastid variable of type int

enter image description here

2) can use variable code

settings.default.lastid = lastid; settings.default.save(); 

the saved value available after application restarts

lastid = settings.default.lastid; 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -