Browsing 7239 questions and answers with Jon Skeet
One benefit of using enums is that it's strongly typed. Consider two sets of constants, both of which have integer representations. If you just use fields as you've proposed, there's nothing to stop you from passing the wrong kind of value... more 1/1/2014 10:37:17 PM
No, you can't - Assert will throw an exception if it fails, and you can't just keep going after the exception. You could catch the exceptions, and then add them into a collection... but it's not terribly nice. If you're trying to... more 1/1/2014 8:12:43 PM
What is the best way to build this type of command string. You use parameterized SQL. Do not concatenate the values you want to use into the SQL like this. It opens you up to SQL injection attacks, conversion errors, and generally... more 1/1/2014 8:10:07 PM
They're similar but not the same. In particular, names are also used for access control in Java (where the default access makes a member available within the same package). That's not the case in .NET - namespaces don't come into... more 1/1/2014 7:18:08 PM
We'll your log shows a NumberFormatException at RouteReader lines 35. That's not a NullPointerException - it's a failure to parse a string as an integer, because the string is "1S". You should work out what you want to do with invalid... more 1/1/2014 7:12:55 PM
Does anyone know why async methods are not allowed to have ref and out arguments? Sure. Think about it - an async method usually returns almost immediately, long before most of the actual logic is executed... that's done... more 1/1/2014 11:27:09 AM
Well it's syntactically valid Java code, but I wouldn't expect it to work at execution time: 0 isn't a valid month 0 isn't a valid day-of-month 0 may or may not be a valid year, depending on how you're counting things. (It appears to... more 1/1/2014 11:14:33 AM
You're not doing the same thing with BigInteger - you're calling the add method which returns a reference to a new BigInteger, and you're assigning that value back to big. Your Sample.add method changes the existing object... more 1/1/2014 10:59:34 AM
You're really proposing set operations more than list operations - in which case you'd be better off using a HashSet than an ArrayList. Then you could use Collection<E>.removeAll: Set<String> a = ...; Set<String> b =... more 1/1/2014 10:10:27 AM
I suspect you just need: var query = db.GroupDetail .OrderBy(...) // You really need an ordering .Skip(intSkip) .Take(mintPageSize); You should work out what ordering you want, otherwise "the... more 1/1/2014 9:58:06 AM