Browsing 7239 questions and answers with Jon Skeet
One option is to initialize it to null to start with: MySqlDataReader rdr = null; After all, you're already checking whether it's null within the finally block in your sample code, so that's fine. It's not clear why you're not just... more 6/23/2014 10:34:54 AM
If your start variable is of time DateTime, I suspect you want DateTime.withDayOfMonth: start = start.withDayOfMonth(new_day); Other types (e.g. LocalDateTime) have similar methods. (I'd also advise you to start following Java naming... more 6/23/2014 9:20:22 AM
Is default and CultureInfo.InvariantCulture are one and the same? No, absolutely not. The default culture depends (initially) on the operating system settings. The invariant culture is meant to be a "neutral" culture. Your example of... more 6/23/2014 8:54:28 AM
You're declaring two very different things here: The first line declares a delegate type called MyMethod The second line declares a field of that delegate type It's important to understand the difference, because then you can work out... more 6/23/2014 6:13:04 AM
Currently you're trying to pass in a model which is a query, whereas your view is expecting a single model object. Currently your check for nullity is pointless, too - the result of Where is never null... it's just a query. Instead, you... more 6/22/2014 2:33:53 PM
Does Java use separate chaining only for collision handling? Yes. You can only have one entry per key in a Hashtable (or HashMap, which is what you should probably be using - along with generics). It's a key/value map, not a... more 6/22/2014 8:15:36 AM
This is the problem: name[i] = values[i]; Your name array is only half the size of your values array, but you're trying to use the same indexes. I suspect you want: name[i / 2] = values[i]; Or more readably in my view: // Note... more 6/22/2014 7:53:48 AM
Well, that's nearly all that happens. In this particular case, your lambda expression (it's not an anonymous method, to be picky) doesn't need any state, so the generated method can be static, and a delegate reference can be cached. So the... more 6/22/2014 7:50:35 AM
You're only reading a single byte - I suspect you meant to write a while loop instead of an if statement: while (fsRead.Position != fsRead.Length) { byte b = (byte)fsRead.ReadByte(); fswrite.WriteByte(b); } However, that's still... more 6/22/2014 7:43:39 AM
Usually, a RuntimeException indicates a programming error (in which case you can't "handle" it, because if you knew to expect it you'd have avoided the error). Catching any of these general exceptions (including Throwable) is a bad idea... more 6/21/2014 6:24:28 PM