Browsing 7239 questions and answers with Jon Skeet
This line: public static string [] starGenerated = new string[numberOfForbiddenWords]; ... is executed when the class is initialized. That will happen while numberOfForbiddenWords is still 0, i.e. long before this line is... more 6/15/2015 9:30:37 AM
This is covered by section 8.3.3 of the JLS: Use of class variables whose declarations appear textually after the use is sometimes restricted, even though these class variables are in scope (§6.3). Specifically, it is a compile-time... more 6/15/2015 6:19:24 AM
The problem is that you're calling connection.getContentLength() before you're calling setRequestProperty(). The content length is only available after you've made a request, at which point you can't set the request property... It's not... more 6/15/2015 6:00:04 AM
It seems wierd to me, because the definitioin of WebSocketHandler ctor gets a nullable value, which means the ctor could get no parameter No, it doesn't. There's a big difference between receiving a null value for a nullable type, and... more 6/14/2015 8:36:48 PM
The constructor for BitArray(bool[]) accepts the values in index order - and then CopyTo uses them in the traditional significance (so bitArray[0] is the least significant bit) - so your true, true, false, false ends up meaning 0011 in... more 6/14/2015 8:21:29 PM
I strongly suspect the problem is that the Text property is never null for any of txt_sel*. Assuming these are text boxes in a UI, it's much more likely that if there's no text in the text box, the Text property will return "" instead of... more 6/14/2015 6:37:04 AM
Numeric literals are specified in JLS 3.10.1. A decimal numeral is either the single ASCII digit 0, representing the integer zero, or consists of an ASCII digit from 1 to 9 optionally followed by one or more ASCII digits from 0 to 9... more 6/13/2015 7:00:36 AM
Just use decimal.Parse but specify a CultureInfo. There's nothing "random" about it - pick an appropriate CultureInfo, and then use that. For example: using System; using System.Globalization; class Test { static void Main() { ... more 6/12/2015 9:47:21 PM
It's valid Java, but you're slightly more likely to run into problems when: Transferring your source code between computers Compiling Editing Pretty much everything handles ASCII with no problems, and most encodings are either... more 6/12/2015 6:57:02 PM
There's nothing special about Toast here. You're just calling a static method which creates an instance (or could possibly reuse an existing one - it's an implementation detail). This is a pattern you'll see all over the place -... more 6/12/2015 5:23:03 PM