How do I work with data files?
So here's the deal. I learned to program with python, and C# is my second step up the ladder. I'm currently learning the language by making a Sudoku game (just porting over the code from python..nothing fancy).
So I ran into a dead end just now...I know how to manipulate data files {*.dat) in python, to store objects/arrays/ etc. How is this done in C#? I need a quick way to open a file, and put/get two objects in/from it.
P.S. is shelving available in C# as well, because something like that is what I'm talking about. (It says somewhere in the python docs or something that shelving[what I'm used to using] is domething from C, or C++[memory is foggy])
scru
Posting Virtuoso
1,629 posts since Feb 2007
Reputation Points: 975
Solved Threads: 140
are you trying to write objects to a file?
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
scru
Posting Virtuoso
1,629 posts since Feb 2007
Reputation Points: 975
Solved Threads: 140
Oh right. Erm I never do such things. I just read in a normal text file and that parse that data into my class or structure.
Since I don't do it I won't be offering any advice. Good luck though.
http://www.codeproject.com/csharp/objserial.asp
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Yes I love python, lol. It's quite easy.
You guys are right though: all I had to do was look at it differently to get comfortable, and I am now. I've actually come to love some of C#s features, like the strong typing (for some reason...maybe I just like declaring variables and stuff...xD), and the intellisense (even though I think that's an IDE feature).
Oh, and that Resource file thing rocks too.
I'll try that dat file thingie and let you know how it goes.
scru
Posting Virtuoso
1,629 posts since Feb 2007
Reputation Points: 975
Solved Threads: 140
scru
Posting Virtuoso
1,629 posts since Feb 2007
Reputation Points: 975
Solved Threads: 140