Click here to Skip to main content
15,925,371 members
Home / Discussions / C#
   

C#

 
QuestionHow Do I: Set the installed Path in the Registry from a setup project? Pin
Tony Archer1-Jun-04 15:39
Tony Archer1-Jun-04 15:39 
AnswerRe: How Do I: Set the installed Path in the Registry from a setup project? Pin
Heath Stewart2-Jun-04 3:12
protectorHeath Stewart2-Jun-04 3:12 
GeneralPrivate/Public Pin
Wackatronic1-Jun-04 14:12
Wackatronic1-Jun-04 14:12 
GeneralRe: Private/Public Pin
Edbert P1-Jun-04 17:34
Edbert P1-Jun-04 17:34 
GeneralRe: Private/Public Pin
Heath Stewart2-Jun-04 3:09
protectorHeath Stewart2-Jun-04 3:09 
GeneralDocking a Windows Form Pin
MeterMan1-Jun-04 13:43
MeterMan1-Jun-04 13:43 
GeneralRe: Docking a Windows Form Pin
Heath Stewart2-Jun-04 3:06
protectorHeath Stewart2-Jun-04 3:06 
GeneralFastest way to convert from/to byte array Pin
Werdna1-Jun-04 13:43
Werdna1-Jun-04 13:43 
I need to convert various datatypes (mostly doubles, bytes and strings) to byte array and then read it back. I need to read it the fastest way possible and it will be read thousands of times and written only once.
What I use now is BinaryReader/Writer like so:
MemoryStream stream = new MemoryStream()
BinaryWriter writer = new BinaryWriter(stream)
.. loop ..
writer.write(byte)
writer.write(double)
writer.write(string)
...
return stream.ToArray();

I don't care how fast writing is.

Then I need to read the data:
byte[] data = ...
MemoryStream stream = new MemoryStream(data);
BinaryReader reader = new BinaryReader(stream);
while (stream.Position < stream.Length)
{
byte b = reader.ReadByte();
switch (b)
{
// depending on value of b read strings, doubles or bytes
}

}

This approach doesn't seem to be too fast. I'm wondering if there is a faster way to do that.
Thanks.

GeneralRe: Fastest way to convert from/to byte array Pin
Heath Stewart2-Jun-04 3:04
protectorHeath Stewart2-Jun-04 3:04 
GeneralPassing managed object through clipboard Pin
rkvs1-Jun-04 10:35
rkvs1-Jun-04 10:35 
GeneralRe: Passing managed object through clipboard Pin
Heath Stewart1-Jun-04 11:16
protectorHeath Stewart1-Jun-04 11:16 
GeneralRe: Remoting with Events Pin
Wouter Van Ranst1-Jun-04 10:20
Wouter Van Ranst1-Jun-04 10:20 
GeneralCustom Control Pin
rags1-Jun-04 9:33
rags1-Jun-04 9:33 
GeneralRe: Custom Control Pin
Heath Stewart1-Jun-04 9:57
protectorHeath Stewart1-Jun-04 9:57 
GeneralRe: Custom Control Pin
rags1-Jun-04 10:41
rags1-Jun-04 10:41 
GeneralRe: Custom Control Pin
Heath Stewart1-Jun-04 11:05
protectorHeath Stewart1-Jun-04 11:05 
GeneralRe: Custom Control Pin
rags1-Jun-04 11:15
rags1-Jun-04 11:15 
GeneralRe: Custom Control Pin
Heath Stewart1-Jun-04 11:18
protectorHeath Stewart1-Jun-04 11:18 
GeneralRe: Custom Control Pin
Wackatronic1-Jun-04 9:57
Wackatronic1-Jun-04 9:57 
GeneralRe: Custom Control Pin
rags1-Jun-04 10:43
rags1-Jun-04 10:43 
GeneralLZW compression using C# Pin
Bettie1-Jun-04 9:08
Bettie1-Jun-04 9:08 
GeneralRe: LZW compression using C# Pin
Heath Stewart1-Jun-04 9:11
protectorHeath Stewart1-Jun-04 9:11 
GeneralRe: LZW compression using C# Pin
flipdoubt1-Jun-04 10:50
flipdoubt1-Jun-04 10:50 
GeneralRe: LZW compression using C# Pin
Heath Stewart1-Jun-04 11:07
protectorHeath Stewart1-Jun-04 11:07 
GeneralRe: LZW compression using C# Pin
flipdoubt1-Jun-04 11:09
flipdoubt1-Jun-04 11:09 

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.