Browsing 7239 questions and answers with Jon Skeet
If you want to create a function which adds 1 to its input, the method to create that function doesn't need an parameters... but then you need to call that function in order to execute it. I suspect you wanted: import... more 10/5/2015 4:32:23 PM
Why do we specify "new Type[0]" in Line X even though there are no parameters in Default Constructor To say that there are no parameters - so the array of parameter types is empty. Why do we specify "(new[] { typeof(int) })" in... more 10/5/2015 3:52:12 PM
You're inconsistent between whether you're trying to handle input + 1 or input elements. For example: int[] array = new int[input+1]; for (int i = 0; i <=input-1; i++) { Console.WriteLine("Please enter entry number " + counter); ... more 10/5/2015 3:48:45 PM
Yes, for the enum form (StringComparison) that's fine. MS is incredibly unlikely to add another StringComparison value now, given that adding a value to an enum is effectively a breaking change. For a StringComparer, it's rather harder :( more 10/5/2015 3:42:10 PM
This is the problem: $date = date("d-m-Y", strtotime($date) + 86400); You appear to be relying on that to increment the date. Usually, that will be fine... but it isn't when we have a 25 hour day, due to daylight saving time changes. I... more 10/5/2015 3:10:17 PM
Basically, using InternalsVisibleTo from a signed assembly requires the assembly it's trusting to be signed too. You need to sign both the test project and the production project... or (if you really must) ditch the tests, and remove the... more 10/5/2015 11:29:34 AM
The range of float is much larger than the range of long... there's an implicit conversion which may lose precision, but not magnitude. The same is true for long to double. From JLS 5.1.2: A widening primitive conversion from int to... more 10/5/2015 9:48:10 AM
You're comparing Double values by reference equality. I suspect you want if (!other.puntoX.equals(this.puntoX)) etc. I'd actually write this code as: @Override public boolean equals(final Object obj) { if (obj == null ||... more 10/5/2015 8:44:24 AM
It's not that unary operators don't work - for example -(+(-5)) is fine. But ++ doesn't just compute a value - its purpose is to increment a variable. 0 isn't a variable. From JLS 15.14.2 (postfix increment operator++) The result of... more 10/4/2015 8:33:07 AM
No, they're very slightly different. Because you've got an explicitly-typed range variable here: from User user in database.Users your query is equivalent to: var results = database.Users .Cast<User>(); ... more 10/4/2015 7:57:48 AM