Browsing 7239 questions and answers with Jon Skeet
It sounds like you haven't got a test where the execution status isn't success - in other words, the first operand of your && expression is true for all tests, so you're not checking that it's relevant. (In general, if you can... more 5/1/2014 1:57:59 PM
You're currently converting a string to Windows-1252 and then converting it back to a string by interpreting those bytes as UTF-8. That is not working fine - that's broken, basically. If you've already got a string, it's not in... more 5/1/2014 1:50:22 PM
You're using DD in your format string, which means "day of year". So after parsing the month as April, you're then going to the 30th day of the year, which is in January... You want dd, for "day of month". When in doubt, if a format... more 5/1/2014 1:21:51 PM
Okay, given that you mean ASCII rather than UTF-8, there are two immediate options: Intermediate byte array byte[] encodedText = text.getBytes(StandardCharsets.US_ASCII); System.arraycopy(encodedText, 0, data, 6,... more 5/1/2014 1:08:56 PM
Because ArrayList.remove doesn't use reference identity (which is what you get with ==) - it uses equals. From the documentation: Removes the first occurrence of the specified element from this list, if it is present. If the list does... more 5/1/2014 12:22:54 PM
Two simple options involving loops, both assuming you have already checked that the input is non-empty and has an even number of characters: Use StringBuilder StringBuilder builder = new StringBuilder(data.length() * 3 / 2 - 1); for (int... more 5/1/2014 8:39:34 AM
It's easiest not to think of object and Object as being interchangeable at all, in fact. It's better to understand object as an alias for global::System.Object. So whenever it you see global::System.Object as a type name, you can use... more 5/1/2014 6:06:04 AM
The language specification helps us out here. Section 7.19 of the C# 5 spec states: A constant expression must be the null literal or a value with one of the following types: sbyte, byte, short, ushort, int, uint, long, ulong, char,... more 4/30/2014 8:07:08 PM
These longs were all different, again as expected. HOWEVER, I then tried to "inspect" the upper two bits to see which state corresponded to what settings, and found that the upper two bits were set the same in all three. I really... more 4/30/2014 7:52:22 PM
Given that you're not using the parameter at all, I'd create a new generic method: private static void GenericSetActive<T>(T ignored) { SetActive(true); } Then create a delegate using that: var genericMethod =... more 4/30/2014 7:45:38 PM