Browsing 7239 questions and answers with Jon Skeet
for me both snippets looks like same. They're clearly not the same. In your second snippet, you've got two variable declarations for the same name in the same class. That's a violation of this part of section 8.3 of the JLS: It is... more 5/22/2014 11:48:46 AM
In section 15.21.3 (Reference Equality Operators == and !=): It is a compile-time error if it is impossible to convert the type of either operand to the type of the other by a casting conversion (§5.5). The run-time values of the two... more 5/22/2014 11:05:13 AM
Look at this loop: while (text[i] != '>') { result[i] += text[i]; } That will continue executing until the condition isn't met. Given that you're not changing text[i], it's never going to stop... Additionally, you're calling... more 5/22/2014 9:19:16 AM
You've specified a link, but you haven't specified a classpath - you need to tell the javadoc task where to find the jar files (or whatever) which contain those types, just as you do when building. You should almost certainly use the same... more 5/22/2014 9:15:50 AM
Unless the ordering really matters, I suspect you just want to make it another property of the error: // Variable names edited to follow normal C# conventions var jsonResponse =... more 5/22/2014 8:58:56 AM
The problem is precisely because you've got a struct - and a mutable struct at that. The indexer will return a value - if the compiler actually did let you change that value, it wouldn't modify the value that's already in the... more 5/22/2014 8:30:53 AM
You're trying to access a static member via a reference. That doesn't work in C#, fortunately - it can lead to very misleading code where it's allowed, e.g. in Java. Instead, you should use the name of the class to access a static... more 5/22/2014 6:48:23 AM
You can only use a binary search if you already have all the data (and if it's sorted, which it looks like it may be here). I strongly suspect that the bottleneck isn't the Contains method here - I would expect it to be the data transfer.... more 5/22/2014 6:17:10 AM
This is defined in the JLS. Section 15.18.1 (string concatenation operator) has: If only one operand expression is of type String, then string conversion (§5.1.11) is performed on the other operand to produce a string at run... more 5/22/2014 6:00:56 AM
Should it always be public static void main(String[] args)? Yes, if you want it to act as an entry point. Can't it be public static int main with some arguments other than string type? No. Section 12 of the JLS explains JVM... more 5/22/2014 5:40:18 AM