You have a bunch of different ways.
1. StreamReader and StreamWriter classes, allow you to read files.
// create or open a file
StreamWriter writer = new StreamWriter("c :\\test.txt");
// write data to it
writer.WriteLin e("File created using StreamWriter class.");
// close
writer.Close();
similar class called StreamReader reads the file.
Also you could create a class which derives from a persistent class,
which then allows you to write that classes properties to disk.
[Serializable]
public class Dog {
public string name;
public string licenseTag;
}
Dog d = new Doc ();
d.name = "Rex";
d.tag = "OU812";
IFormatter formatter = new BinaryFormatter ();
Stream stm = new FileStream("myD ataStore.dta",
FileMode.Create , FileAccess.Writ e,
FileShare.None) ;
formatter.Seria lize (stm,d); // stream the dog object out to disk.
stm.Close();
To read it back:
;IFormatter fmt = new BinaryFormatter ();
Stream stm = new FileStream("myD ataStore.dta",
FileMode.Open, FileAccess.Read ,
FileShare.Read) ;
Dog dogFromDisk = (Dog) fmt.Deserialize (stm);
stm.Close();
// the data has now been restored in the object
//
this will store the data in binary. If you need moer security then you could
(just a wacky thought)
after you write the object to disk, then encrypt it. When you load the
object back into memory, then
decrypt the file before loading the stream.
With the file writina approach you could also encrypt it before you write it
to file
and then when you read the data back in, then once you have read it, then
decrypt it maybe?
of course, there are things like xml disconnected datasets and databases and
all that, but my
impression was you wanted to store some simple data say password or
something like that in a file, which
is in the same directory as the application or something like that. With
that assumption, i think
these approaches should get you up and running pretty quickly without the
need for you
to learn any of those other technologies... . but as I said it depends on
your needs.
hope that helps,
J
hope thi
"pei_world" <pe*******@hotm ail.com> wrote in message
news:OW******** ******@TK2MSFTN GP12.phx.gbl...
hi
I am new to C# programming. can anyone tell me what is the standard way
to store high sensitive user data for application, so that application next
run can get back those data.