Not like that!
If you look back at my previous answer, that is a rectangular array (doubles or ints, bools or TextBoxes, it doesn't matter what the type is) so you have to tell the compiler how big it is!
double[ , , ,] m_array4 = new double[,,,];
Will give a compilation error, because new double[,,,] does not specify all (or indeed any) of the dimensions. Without them, the space cannot be allocated, and it will complain.
double[ , , ,] m_array4 = new double[3,4,5,6];
Will do it, but - remember I said they get big quickly? - it allocates space for 360 doubles...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
For some reason, while reading a GZip file I am having an issue where it stops after about 24K characters; it never reaches the end of file (I have tried it on several Gzip files of differing sizes, each containing one text file).
I created a small console app to replicate the problem, see below. Any insight would be welcomed...
Framework is .NET 3.5
staticvoid Main(string args)
UInt64 charsRead = 0;
if (args.Length > 0)
file = args;
Console.Write("GZip file to be read (full path): ");
file = Console.ReadLine();
using (GZipStream gz = new GZipStream(new FileInfo(file).OpenRead(), CompressionMode.Decompress))
byte bytes = new byte;
while (gz.Read(bytes, 0, 1) > 0)
Console.WriteLine("Characters Read: " + charsRead);
I've never treated the GZipStream like that, but you could try using one of the decompression example out of MSDN found here[^]. If you don't retrieve the original file out of the zip, you may be dealing with a different compression that isn't supported. If you do, then it'd be something to do with how you're reading it out here.
Unfortunately, that example is .NET 4.0 specific. This line:
Will not work in 3.5, because the CopyTo method does not exist (in fact, if you change the framework version in the link you provided, the example disappears). The example at this url at MSDN (the class page itself) does use the 3-parameter Read method (it is 3.5).
Part of my objective is to "read" the contents of a Gzip file *without* extracting it to disk. However, having it stop early is a problem...
Now that I have access to VS today, I can test your code. After creating a GZip file with .NET, via the following code:
using (GZipStream gz = new GZipStream(new FileInfo(file).Create(), CompressionMode.Compress))
byte bytes = File.ReadAllBytes(file);
gz.Write(bytes, 0, bytes.Length);
I then ran your code against it and it worked just fine. The question I have is are you accessing a file that isn't local? If so, this may be the source of your problem. Otherwise, you might want to create the zip file with .NET and see if that solves your problem.
Are you using the XML serializer? The .NET XML serializer (well, the deserializer side) throws exceptions when it deserializes because of the way its implemented internally. They create an in-memory assembly on the fly, etc. and do a bunch of wacky stuff. It *is* however a handled exception by .NET and you shouldn't even see it inside your application unless you have First Chance Exceptions turned on. Nothing you can do about it besides turning First Chance Exceptions off or going to the binary serializer / deserializer.
I've kind of programmed myself into a corner. I just changed my application to use David Hall's Task Scheduler Library for Net, so now the app requires elevated permissions (run as Administrator). However, I discovered that when I 'run as administrator' the app's connection to QuickBooks fails. Some research led me to find that the QuickBooks SDK will not work with elevated permissions on Windows 7. So now part of my app requires elevated permission and part of it requires non-elevated permission.
I think I can get around this by splitting the task scheduler code off in a separate process like this example:
"A new process with elevated privileges can be spawned from within a .NET application using the "runas" verb. An example using C#:"
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "C:\\Windows\\system32\\notepad.exe";
proc.StartInfo.Verb = "runas"; // Elevate the application
So my question is, is this the only way? Are there other, better alternatives? Thanks.