By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,652 Members | 1,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,652 IT Pros & Developers. It's quick & easy.

Property Question

P: n/a
does a property keep its value even when a program is turned off

for instance if i make a class
account
with a property of account name
will it keep that value when i turn off the program

WStoreyII
Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Only if it returns a constant. Otherwise, no.

To do so you would have to serialize the object and write it to disk (or
another medium for storage)

"WStoreyII" <pa**********@sbcglobal.net> wrote in message
news:E5**********************************@microsof t.com...
does a property keep its value even when a program is turned off?

for instance if i make a class
account
with a property of account name
will it keep that value when i turn off the program ?

WStoreyII

Nov 20 '05 #2

P: n/a
If property is set by the user, than you'd have to persist it somehow,
either serialize it or store it in a DB or the registry to be able to get it
Property values are stored in RAM so once the program closes, that space is
cleared out. So the only way you'd get the value again is if it was
persisted or it always returned the same thing.
"WStoreyII" <pa**********@sbcglobal.net> wrote in message
news:E5**********************************@microsof t.com...
does a property keep its value even when a program is turned off?

for instance if i make a class
account
with a property of account name
will it keep that value when i turn off the program ?

WStoreyII

Nov 20 '05 #3

P: n/a
Hi WStoreyII,

Properties cannot store the values as such. You can refer http://www.dotnetspider.com/Technolo...x?SampleId=221 for further details.

Sadha Sivam S
Malleable Minds Software Pvt Ltd
Nov 20 '05 #4

P: n/a
Hi WStoreyII

When you start your program again a complete "New" object (class) is
created.
You are not connecting to your old program.

Cor
Nov 20 '05 #5

P: n/a
* "CJ Taylor" <cege at the123 dont use this part till here tavayn dot com> scripsit:
Only if it returns a constant. Otherwise, no.


LOL!

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.