Click here to Skip to main content
15,908,775 members
Home / Discussions / C#
   

C#

 
AnswerRe: File Structure Serialization Pin
carbon_golem1-May-08 2:59
carbon_golem1-May-08 2:59 
I have a couple of questions.
1) What are you encrypting, and why a Hashtable?
2) Why did you choose a struct?
3) Have you checked the post-RawSerialize() byte arrays to verify sizes?
4) Are you using unmanaged code in your project?

And recommendations.
1) Go back on the Net and study up on the difference between ValueTypes and ReferenceTypes.
2) Use caution when you snag some code, you'll have to understand what's going on.

What I think is going on here is a boxing issue. You're using a struct to hold data, however your serialization routines are calling for Object. So, when you pass in your struct it is boxed, turning it into a reference type. Then you're calling Marshal.StructureToPtr passing in the boxed value. In essence you're serializing the address of your struct. That's why it's writing the 4 characters (8 bytes) to the file.

Scott P

"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

GeneralRe: File Structure Serialization Pin
Ian Uy1-May-08 3:05
Ian Uy1-May-08 3:05 
GeneralRe: File Structure Serialization Pin
carbon_golem1-May-08 3:41
carbon_golem1-May-08 3:41 
GeneralRe: File Structure Serialization Pin
Ian Uy1-May-08 3:49
Ian Uy1-May-08 3:49 
GeneralRe: File Structure Serialization Pin
carbon_golem1-May-08 3:57
carbon_golem1-May-08 3:57 
QuestionPlease Help !Query executing in oracle but not executing through code Pin
ravindradonkada30-Apr-08 19:46
ravindradonkada30-Apr-08 19:46 
AnswerRe: Please Help !Query executing in oracle but not executing through code Pin
Christian Graus30-Apr-08 20:18
protectorChristian Graus30-Apr-08 20:18 
AnswerRe: Please Help !Query executing in oracle but not executing through code [modified] Pin
Mircea Puiu1-May-08 4:46
Mircea Puiu1-May-08 4:46 
QuestionDetect Shift when Menu Opens Pin
Chris_McGrath30-Apr-08 19:28
Chris_McGrath30-Apr-08 19:28 
AnswerRe: Detect Shift when Menu Opens Pin
Chris_McGrath30-Apr-08 19:45
Chris_McGrath30-Apr-08 19:45 
QuestionHOW TO CREATE AN INSTANCE OF INTERNET EXPLORER AND HOW TO USE IT? Pin
syamooo30-Apr-08 18:55
syamooo30-Apr-08 18:55 
AnswerRe: HOW TO CREATE AN INSTANCE OF INTERNET EXPLORER AND HOW TO USE IT? Pin
Christian Graus30-Apr-08 19:18
protectorChristian Graus30-Apr-08 19:18 
GeneralRe: HOW TO CREATE AN INSTANCE OF INTERNET EXPLORER AND HOW TO USE IT? Pin
syamooo30-Apr-08 19:38
syamooo30-Apr-08 19:38 
GeneralRe: HOW TO CREATE AN INSTANCE OF INTERNET EXPLORER AND HOW TO USE IT? Pin
Christian Graus30-Apr-08 19:53
protectorChristian Graus30-Apr-08 19:53 
GeneralRe: HOW TO CREATE AN INSTANCE OF INTERNET EXPLORER AND HOW TO USE IT? Pin
Zoltan Balazs30-Apr-08 20:00
Zoltan Balazs30-Apr-08 20:00 
GeneralRe: HOW TO CREATE AN INSTANCE OF INTERNET EXPLORER AND HOW TO USE IT? Pin
Christian Graus30-Apr-08 20:13
protectorChristian Graus30-Apr-08 20:13 
GeneralRe: HOW TO CREATE AN INSTANCE OF INTERNET EXPLORER AND HOW TO USE IT? Pin
Zoltan Balazs30-Apr-08 20:30
Zoltan Balazs30-Apr-08 20:30 
GeneralRe: HOW TO CREATE AN INSTANCE OF INTERNET EXPLORER AND HOW TO USE IT? Pin
Christian Graus30-Apr-08 20:39
protectorChristian Graus30-Apr-08 20:39 
GeneralRe: HOW TO CREATE AN INSTANCE OF INTERNET EXPLORER AND HOW TO USE IT? Pin
Anthony Mushrow1-May-08 1:38
professionalAnthony Mushrow1-May-08 1:38 
QuestionHow to Intercept WebBrowser Control default download with my custom downloader? Pin
Anindya Chatterjee30-Apr-08 18:10
Anindya Chatterjee30-Apr-08 18:10 
AnswerRe: How to Intercept WebBrowser Control default download with my custom downloader? Pin
Anthony Mushrow1-May-08 1:47
professionalAnthony Mushrow1-May-08 1:47 
GeneralRe: How to Intercept WebBrowser Control default download with my custom downloader? Pin
Spacix One1-May-08 8:50
Spacix One1-May-08 8:50 
GeneralRe: How to Intercept WebBrowser Control default download with my custom downloader? Pin
Anthony Mushrow1-May-08 11:36
professionalAnthony Mushrow1-May-08 11:36 
GeneralRe: How to Intercept WebBrowser Control default download with my custom downloader? Pin
Spacix One2-May-08 5:01
Spacix One2-May-08 5:01 
GeneralRe: How to Intercept WebBrowser Control default download with my custom downloader? Pin
Anindya Chatterjee1-May-08 10:30
Anindya Chatterjee1-May-08 10:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.