Click here to Skip to main content
15,893,722 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Coding styles Pin
Member 448708329-Oct-10 23:12
Member 448708329-Oct-10 23:12 
GeneralRe: Coding styles Pin
PIEBALDconsult31-Oct-10 4:27
mvePIEBALDconsult31-Oct-10 4:27 
GeneralRe: Coding styles Pin
Member 44870832-Nov-10 7:39
Member 44870832-Nov-10 7:39 
GeneralRe: Coding styles Pin
PIEBALDconsult2-Nov-10 18:22
mvePIEBALDconsult2-Nov-10 18:22 
GeneralRe: Coding styles Pin
Member 44870833-Nov-10 7:35
Member 44870833-Nov-10 7:35 
AnswerRe: Coding styles Pin
Abhinav S29-Oct-10 19:13
Abhinav S29-Oct-10 19:13 
AnswerRe: Coding styles [modified] Pin
Jeff Connelly17-Nov-10 3:42
Jeff Connelly17-Nov-10 3:42 
QuestionSeeking a binary read/write file stream class Pin
PIEBALDconsult28-Oct-10 15:45
mvePIEBALDconsult28-Oct-10 15:45 
For a little something I'm experimenting with, I'd like to be able to (binary) read and write various types of object, like I can with C. The biggest need currently is byte, long, and Guid, but I'd like a more general solution.

BinaryReader and -Writer won't do it; they only support a few types (not Guid) and (apparently) not read/write.

So so far I've been working with a FileStream. At this time, I can do byte (which is built into FileStream), and long and Guid via "unsafe" code.

The problem has been in making generic read and write methods:

T Read<T>()
void Write<T>( T Value )

C# doesn't want to make a pointer to a generic type. I got around that (I think) by using a GCHandle, and maybe that's the best I can do.


Anyway... I have a sneaking suspicion that this has been solved before. Shouldn't others have run into the same need?

Does anyone here have information on such a beast?

(If not, I'll write an article when I'm done.)
AnswerRe: Seeking a binary read/write file stream class Pin
Luc Pattyn28-Oct-10 15:57
sitebuilderLuc Pattyn28-Oct-10 15:57 
GeneralRe: Seeking a binary read/write file stream class Pin
PIEBALDconsult28-Oct-10 16:57
mvePIEBALDconsult28-Oct-10 16:57 
GeneralRe: Seeking a binary read/write file stream class Pin
Luc Pattyn28-Oct-10 17:14
sitebuilderLuc Pattyn28-Oct-10 17:14 
GeneralRe: Seeking a binary read/write file stream class [modified] Pin
PIEBALDconsult28-Oct-10 17:21
mvePIEBALDconsult28-Oct-10 17:21 
AnswerRe: Seeking a binary read/write file stream class Pin
_Erik_29-Oct-10 3:10
_Erik_29-Oct-10 3:10 
GeneralRe: Seeking a binary read/write file stream class Pin
PIEBALDconsult29-Oct-10 3:27
mvePIEBALDconsult29-Oct-10 3:27 
AnswerRe: Seeking a binary read/write file stream class Pin
Andy Brummer3-Nov-10 18:19
sitebuilderAndy Brummer3-Nov-10 18:19 
GeneralRe: Seeking a binary read/write file stream class [modified] Pin
PIEBALDconsult7-Nov-10 4:44
mvePIEBALDconsult7-Nov-10 4:44 
Questionhelp needed Pin
rksreadero28-Oct-10 8:52
rksreadero28-Oct-10 8:52 
AnswerRe: help needed PinPopular
Luc Pattyn28-Oct-10 9:07
sitebuilderLuc Pattyn28-Oct-10 9:07 
AnswerRe: help needed Pin
kadaoui el mehdi28-Oct-10 11:19
kadaoui el mehdi28-Oct-10 11:19 
GeneralRe: help needed Pin
Pete O'Hanlon28-Oct-10 11:34
mvePete O'Hanlon28-Oct-10 11:34 
GeneralRe: help needed Pin
kadaoui el mehdi28-Oct-10 11:39
kadaoui el mehdi28-Oct-10 11:39 
GeneralRe: help needed Pin
Pete O'Hanlon28-Oct-10 11:47
mvePete O'Hanlon28-Oct-10 11:47 
GeneralRe: help needed Pin
kadaoui el mehdi28-Oct-10 11:49
kadaoui el mehdi28-Oct-10 11:49 
AnswerRe: help needed Pin
TweakBird28-Oct-10 23:38
TweakBird28-Oct-10 23:38 
AnswerRe: help needed Pin
Pete O'Hanlon29-Oct-10 0:40
mvePete O'Hanlon29-Oct-10 0:40 

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.