Browsing 7239 questions and answers with Jon Skeet
You're creating the ZipArchive without specifying a mode, which means it's trying to read from it first, but there's nothing to read. You can solve that by specifying ZipArchiveMode.Create in the constructor call. Another problem is that... more 11/13/2015 7:03:26 AM
As per the question comment, static initialization is not always deterministic. However, you can make it deterministic using static constructors: class C1 : B { static C1(){} public static readonly C1 Default = new C1(); } class... more 11/12/2015 4:14:02 PM
Now that we know you only want the first Image element, it's simple: cruise_Imagerurl = a.Element("Images").Element("Image").Element("URL").Value This assumes there always is at least one image, mind you. If that's not the case, you... more 11/12/2015 11:25:21 AM
[,] Is it the same thing as [][] ? No. I'll use int as the element type to make things simpler. An int[,] is a rectangular array. It's a single object, which is indexed by two dimensions. Each element of the array Note that you can... more 11/12/2015 9:37:46 AM
It sounds like you just want recursion: public int GetNestingLevel(MainClass mc) { return mc.forward == null ? 0 : GetNestingLevel(mc.forward) + 1; } Or as part of MainClass itself: public int GetNestingLevel() { return... more 11/12/2015 8:23:48 AM
Just use d instead of dd - that still allows a leading 0, but doesn't require it. I suspect you'd want to do the same for months as well - it would be odd to have "1-or-2 digit" days but not months... import java.time.*; import... more 11/12/2015 7:52:45 AM
I strongly suspect that this is the problem: ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream()); out.writeObject(msg); Why are you using ObjectOutputStream? That's for Java's native binary serialization... more 11/12/2015 6:54:59 AM
You're currently selecting a sequence of sequences - which is why when you print each element out, it's showing that it's a WhereSelectEnumeratableIterator. I suspect you actually want to just flatten that, so you should use SelectMany... more 11/11/2015 9:48:05 PM
From the Mozilla docs (or devdocs.io): Return value The time-zone offset is the difference, in minutes, between UTC and local time. Note that this means that the offset is positive if the local timezone is behind UTC and negative if... more 11/11/2015 9:18:06 PM
That's not an error - that's just what you get when you print out a double[] because arrays in Java don't override toString(). Just use Arrays.toString(double[]) instead: double[] result = method.bmiCalculation(heightArray,... more 11/11/2015 9:15:26 PM