Click here to Skip to main content
15,893,622 members
Home / Discussions / C#
   

C#

 
QuestionInstance of struct = Object? Pin
Alvaro Mendez29-Aug-03 9:07
Alvaro Mendez29-Aug-03 9:07 
AnswerRe: Instance of struct = Object? Pin
David Stone29-Aug-03 10:27
sitebuilderDavid Stone29-Aug-03 10:27 
GeneralRe: Instance of struct = Object? Pin
Alvaro Mendez29-Aug-03 10:39
Alvaro Mendez29-Aug-03 10:39 
GeneralRe: Instance of struct = Object? Pin
David Stone29-Aug-03 11:41
sitebuilderDavid Stone29-Aug-03 11:41 
Generalipaddress.any Pin
MeisterBiber29-Aug-03 8:49
MeisterBiber29-Aug-03 8:49 
GeneralEnd an invoke early Pin
Ista29-Aug-03 8:30
Ista29-Aug-03 8:30 
General"memory stream is not expandable" Pin
devvvy29-Aug-03 7:32
devvvy29-Aug-03 7:32 
GeneralRe: "memory stream is not expandable" Pin
Daniel Turini29-Aug-03 7:52
Daniel Turini29-Aug-03 7:52 
Your code is a bit confuse:

norm wrote:
byte[] buffer = new byte [10];
buffer = ASCIIEncoding.GetBytes("ABCDE");


Why are you initializing if you are going to set it on the next line?


norm wrote:
MemoryStream mstream2 = new MemoryStream(buffer, 5, 5, true, true);
CryptoStream cstream2 = new CryptoStream(
mstream2,
RMCrypto.CreateEncryptor(Key, IV),
CryptoStreamMode.Write);


Doing this will write on the MemoryStream. This would be ok, but why don't you use the default constructor (which creates an expandable memorystream)? See what's on MSDN about the constructor you used:

Initializes a new non-resizable instance of the MemoryStream class based on the specified region of a byte array, with the CanWrite property set as specified.

This means you'll never be able to write more than the size of "ABCDE" in ASCII encoding, i.e., 5 bytes. This is very low, and some compression schemes add salt. If you eliminate the "buffer" variable, you probably will get the code working right.


You can do it on anything you choose - from .bat to .net - A customer
GeneralRe: "memory stream is not expandable" Pin
devvvy29-Aug-03 8:19
devvvy29-Aug-03 8:19 
GeneralRe: "memory stream is not expandable" Pin
Daniel Turini29-Aug-03 8:26
Daniel Turini29-Aug-03 8:26 
GeneralRe: "memory stream is not expandable" Pin
MeisterBiber29-Aug-03 8:02
MeisterBiber29-Aug-03 8:02 
GeneralRe: "memory stream is not expandable" Pin
devvvy29-Aug-03 8:23
devvvy29-Aug-03 8:23 
GeneralRe: "memory stream is not expandable" Pin
MeisterBiber29-Aug-03 8:32
MeisterBiber29-Aug-03 8:32 
GeneralRe: "memory stream is not expandable" Pin
devvvy29-Aug-03 14:22
devvvy29-Aug-03 14:22 
GeneralRe: "memory stream is not expandable" Pin
Daniel Turini29-Aug-03 8:33
Daniel Turini29-Aug-03 8:33 
GeneralRe: "memory stream is not expandable" Pin
devvvy29-Aug-03 14:16
devvvy29-Aug-03 14:16 
GeneralRe: "memory stream is not expandable" Pin
David Stone29-Aug-03 10:19
sitebuilderDavid Stone29-Aug-03 10:19 
GeneralRe: "memory stream is not expandable" Pin
devvvy29-Aug-03 14:02
devvvy29-Aug-03 14:02 
GeneralRe: "memory stream is not expandable" Pin
David Stone29-Aug-03 17:20
sitebuilderDavid Stone29-Aug-03 17:20 
GeneralRe: "memory stream is not expandable" Pin
devvvy29-Aug-03 17:55
devvvy29-Aug-03 17:55 
GeneralC# and Outlook... Pin
theJazzyBrain29-Aug-03 6:24
theJazzyBrain29-Aug-03 6:24 
GeneralRe: C# and Outlook... Pin
apferreira29-Aug-03 6:52
apferreira29-Aug-03 6:52 
QuestionHow do I Prevent addition to collections returned by properties Pin
Rahul Singh29-Aug-03 6:21
Rahul Singh29-Aug-03 6:21 
AnswerRe: How do I Prevent addition to collections returned by properties Pin
Frank Olorin Rizzi29-Aug-03 7:34
Frank Olorin Rizzi29-Aug-03 7:34 
AnswerRe: How do I Prevent addition to collections returned by properties Pin
leppie29-Aug-03 7:43
leppie29-Aug-03 7:43 

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.