Browsing 7239 questions and answers with Jon Skeet
You can ignore warnings/errors from Roslyn analyzers in exactly the same ways as ignoring normal C# compiler warnings: #pragma disable within source code The Project Properties / Build / Errors and Warnings setting The [SuppressMessage]... more 1/11/2016 11:34:29 AM
It's not the casting that's the problem - it's the conversion to a string representation. Lerp and Dur are the same value - you can't distinguish between them. Indeed, if you call ToString() directly on them, like... more 1/11/2016 7:08:29 AM
You should cast to IEnumerable<object>, or even just IEnumerable. A List<string> is not a List<object> as generic variance doesn't apply to classes, and a List<string> is not an IList<object> as... more 1/11/2016 7:02:17 AM
No, the difference is in the kind of change you make. This code: s2.setText("second") doesn't change the value of either s2 or s1. Both s1 and s2 refer to the same object as they did before... but the contents of the object has... more 1/10/2016 2:28:32 PM
I would suggest only having a single comparator class for comparing by price, and a separate comparator class to compare by name (or no classes - see the end of my answer). Each class does one thing, and does it well. Then you can reverse... more 1/10/2016 1:55:27 PM
No, Java doesn't have anything like the verbatim string literals of C# and other languages. Backslash is always an escape character in a Java string or character literal. Note that it's only in literals that Java cares, as a language. The... more 1/9/2016 12:30:58 PM
You're declaring the variables inside the blocks. Any local variable is out of scope outside the block in which it's declared. That's why those variables are greyed out - they aren't used anywhere, because the blocks in which they're... more 1/9/2016 7:58:16 AM
It sounds like you don't need to use AtStartOfDay at all - just use the date and add your WorkDayStartTime: public ZonedDateTime GetWorkStartTime(ZonedDateTime zdt) => (zdt.Date + WorkDayStartTime).InZone(zdt.Zone,... more 1/9/2016 7:43:42 AM
But to which class(type) pointer this belongs? this is the list that hashCode was called on. So the compile-time type is AbstractList<E>. It's saying "for every element in this list, include that element's hash code in the... more 1/9/2016 7:40:49 AM
but i don't want the 0's at the beginning of them both, i don't want a 0 at all Then you shouldn't create an array with 0s in, which is what you're doing. Before you call Array.Sort(odds), your array will have all the odd numbers... more 1/8/2016 4:23:00 PM