|
hi !
maybe:
you defined your buffer with size 10.
your memorystream size is set to 5.
andi
|
|
|
|
|
Thanks, tried that. But the problem is that memorystream is not resizable - but even that shouldn't be the problem since Close() throw an exception complaining that memory stream is not resizable even if I'm just writing ONE character to it!? I didn't Seek() on the memory stream - so, should be writing from beginning - if so, i'd just be overwriting ONE character/byte. The buffer has 10 bytes in it. I don't see how why we need to 'expand' the memorystream in the first place.
norm
|
|
|
|
|
>I didn't Seek() on the memory stream - so, should be writing from beginning
i thought you set the position to the end! (buffer, 5, 5!!!!!!!, true, true)
andi
|
|
|
|
|
I use:
MemoryStream(buffer);
when I Seeked(). By the way, not sure if the following overload make the stream expandable or not:
public MemoryStream(byte[], int, int, bool, bool);
MSDN didn't state explicitly that the memory stream is expandable or not as in other versions/overloads. But IF it is, it's the only overload that takes a byte array as argument AND expandable.
Anyway, how can you use default constructor:
MemoryStream mem = new MemoryStream();
and associate a buffer with it later on?
norm
|
|
|
|
|
norm wrote:
The buffer has 10 bytes in it. I don't see how why we need to 'expand' the memorystream in the first place.
Because it seems that the stupid memorystream will try to trim the buffer for you (instead of leaving the rest of unneeded data untouched). And it can't, as byte[]'s are fixed size.
And yes, the error message is very misleading.
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
Daniel Turini wrote:
You can do it on anything you choose - from .bat to .net - A customer
>> it's a lot more painful doing .bat
Daniel Turini wrote:
Because it seems that the stupid memorystream will try to trim the buffer for you (instead of leaving the rest of unneeded data untouched). And it can't, as byte[]'s are fixed size.
>> don't get it, can you elaborate a little more?
norm
|
|
|
|
|
Jeez norm, what kind of application are you writing? First the crypto stuff, now this...
Flight to Redmond - £200
Bulldozer Rental - £100
Destroying the MS campus single handedly for not doing an Academic upgrade, PRICELESS!
-Jonny Newman
|
|
|
|
|
i'm workinng for dexter in his secret laboratory
norm
|
|
|
|
|
Shweet. Now, does DeeDee bug you too?
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
don't have a sister. But my brother boo has gone back to Penn States, which makes it kind of nice if someone can bug me from time to time.
norm
|
|
|
|
|
Hello all,
Has anyone got any idea on how to use the Outlook database through my C# application?
I want to retrieve the Task entries from Outlook XP to my Access database and then use them on an ASP.NET application using C#.
Is there an API that MS provides?
Thank you.
theJazzyBrain
Wise is he who asks good questions, not he who gives good answers
|
|
|
|
|
If you are using Outlook 2002 Why not use the Office 10 Primary Interop Assemblies provided by Microsoft.
You can download them here[^]
A good starting point for installing them and using them can be found here[^]
|
|
|
|
|
Hi,
I have a class that has a get property, Edges that returns an ArrayList. Due to the internal organization of what the class does I want to disallow people getting the property and then adding stuff to it. I want them to use the Add method of the class instead. I could document it and say "dont do that" but I was wondering if there is a way to do it in C#. I can't think of one. Here is some code
public class foo
{
private ArrayList _edges;
public ArrayList Edges
{
get { return _edges; }
}
public void Add(string myString)
{
_edges.Add(myString);
}
}
//I want to prevent the following
foo myFoo = new foo();
//The next statement should throw an exception or something
myFoo.Edges.Add("Hello");
//the following instead should be used.
myFoo.Add("Hello2");
Thanks,
Rahul
|
|
|
|
|
..ehr... pass them deep copies in the returned ArrayList ?
<br />
public ArrayList Edges<br />
{<br />
get<br />
{<br />
ArrayList r = new ArrayList();<br />
foreach(Edge e in this._edges)<br />
r.Add(e.DeepCopy());<br />
return r;<br />
}<br />
}<br />
<br />
Granted, your Edge class has to have a public method to provide a DeepCopy.
I usually use the Clone() method for that.
<br />
public Edge Clone()<br />
{ return new Edge(this); }<br />
<br />
public Edge(Edge rhs)<br />
{<br />
}<br />
[shameless self plug]
I actually use this kind of thing in CFGLite:
http://www.codeproject.com/csharp/CFGLitepack.asp
[/shameless self plug]
HTH,
F.O.R.
|
|
|
|
|
|
leppie wrote:
Hmm didnt we cover this just a few days ago.....
I do think so... If he just used the "great" CP search engine...
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
If you did cover this a few days ago how about posting a link.
If you dont remember the link you can use the Codeproject Search engine to find it. I did that but couldnt find it.
Maybe you will have better luck.
Cheers,
Rahul
|
|
|
|
|
Ok I found it.
But I had to go through all the entries by hand.
Here is a link
http://www.codeproject.com/script/comments/forums.asp?forumid=1649&select=593349&df=100&fr=101#xx593349xx
Thanks.
|
|
|
|
|
Rahul Singh wrote:
Ok I found it.
But I had to go through all the entries by hand.
Here is a link
Sorry, I was joking about CP search engine, and meant that you hadn't found because, as you discovered by yourself, CP search engine sucks most of the time.
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
|
How do I create a reference to a COM Enabled .NET Managed Assembly registered through Component Services on Windows XP?
Please HELP?
|
|
|
|
|
I need to create pseduo columns with my tree view. like using draw string to control the text output.
any got ideas, pointers, or links?
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Can anyone give some insight on the best practices of how/where to use dataadapters and connections in a multi-form application. Most examples I have seen have been 1 form examples and dont really explain how to work with "common" dataadapters. I mostly work with Delphi and it has a DataModule form in which you can locate all of you data connections and each form can access the data thru the datamodule.
Thank you
|
|
|
|
|
Does anybody know where I can find a free class parser in C#?
Thanks
|
|
|
|
|
What do you mean by "class parser" ?
The Reflection namespace should let you do almost everything you may need to do programmatically...
If you need a C# parser, I think there is something in one of the CLR classes (search for "Parser" ?), and you may find something online, but the last time I looked for that, I decided I would have been better off making my own Parser anyway...
Finally, if you just want something that lets you look at classes (like the Object Browser in VS), ..ehr... you can make your own by using the Reflection namespace.
HTH,
F.O.R.
|
|
|
|