Browsing 7239 questions and answers with Jon Skeet
The simplest solution (in terms of changing very little code) would be to have an overload: private float CountAvailability(DateTime startDate, DateTime endDate, string machine) { float ignored1 = 0f, ignored2 = 0f; return... more 10/21/2014 6:04:54 AM
This looks like a plain bug to me: It clearly isn't read-only, as the indexer allows it to be modified It is not performing a conversion to any other kind of object Note that you don't need to cast - there's an implicit... more 10/20/2014 9:50:08 PM
The Contains method does not use the == operator No - it uses Equals, which you haven't overridden... so you're getting the default behaviour of Equals, which is to check for reference... more 10/20/2014 6:39:48 PM
The problem is, when I call writer.Write(ParameterName, Value) and T is a string, it calls the overload for string/object, not string/string! Yes, this is expected - or rather, it's behaving as specified. The compiler chooses the... more 10/20/2014 4:35:39 PM
Yes, this is behaving precisely as documented. Note that the ordering maintained by a sorted set (whether or not an explicit comparator is provided) must be consistent with equals if the sorted set is to correctly implement the Set... more 10/20/2014 3:21:19 PM
I have a loop that genrates timestamps for midnight for every day in a selected timerange. That's your first problem - assuming that midnight even exists. Whether or not that's true depends on your definition of midnight. In the... more 10/20/2014 2:07:02 PM
>>> is the bitwise right-shift operator, with 0 sign extension - in other words, all bits "incoming" from the left are filled with 0s. -1 is represented by 32 bits which are all 1. When you shift that right by 1 bit with 0 sign... more 10/20/2014 1:55:11 PM
Yes, you can do this using just LINQ (reasonably briefly, even), but it's not exactly pleasant: Reverse the list Zip it with the original list to get pairs (1, 9), (2, 8) etc Flatten the result Take only the original number So: var... more 10/20/2014 11:50:53 AM
You need to use the -source option for javac. For example: javac -source 1.7 foo/Bar.java In theory you can specify the source and target options separately, but judging by your comment, it sounds like you can't use Java 8 language... more 10/20/2014 9:33:55 AM
These are attributes. They're not "preprocessor" parts of the language - unlike things like #if, #pragma (which are still not really handles by a preprocessor, but are meant to be thought of that way). Basically, attributes allow you to... more 10/20/2014 6:02:00 AM