Browsing 7239 questions and answers with Jon Skeet
You have to do a tree-walk, I believe. If you want to keep all the attributes in place, you'd need to use XElement.ReplaceAttributes. Otherwise, you can just remove the old ones and add new ones. (You can't modify the name of an... more 9/23/2016 11:17:53 AM
The problem is that you're trying to use T for two purposes: The source of the status code (you're calling StatusCode on it) The type of the status code (it's the type argument for Information<T>) Now you could just make... more 9/23/2016 10:28:38 AM
You normally want to perform the same clean-up action whether an exception is thrown or not. Doing that just with catch blocks is painful - especially if you want to make sure that you only call close() once, even if that throws. You'd end... more 9/23/2016 8:17:02 AM
There's no operation to do this for an arbitrary variable, as far as I'm aware... but this is what the AtomicReference type is for: private AtomicReference<String> stringReference; ... String oldValue =... more 9/23/2016 6:59:23 AM
Basically, the response contains both text and binary data, so using both a Writer and an OutputStream makes perfect sense. The writer just wraps the output stream, and is used to write text. The output stream itself is used to write the... more 9/23/2016 6:38:59 AM
It sounds like really you're just wanting to mask the bottom seven bits - which is most simply done using &: if ((b & 0xff) >= 0x80) { n = (n << 7) + (b & 0x7f); } I've changed everything to either use hex or... more 9/23/2016 5:41:50 AM
It turns out that the reason I had a hard time reproducing this was that it wasn't a code problem at all - it was how the code was being run. If you run the program in a debugger, for some reason setting RedirectStandardError to true... more 9/23/2016 5:39:05 AM
The problem isn't the cast - it's the XML deserialization. The serializer is only creating Item instances, which is why the cast is failing. You need to change your attributes to tell the serializer which types you want to... more 9/23/2016 5:34:54 AM
It sounds like what you really want is for the BaseService<T>.repo field (it's a field, not a property - and I'd discourage you from using public fields, but that's a different matter) to be the appropriate kind of repository for the... more 9/22/2016 10:11:00 PM
You used H in your time format - that's a 24-hour time, so your "start" time is just after midday, more than 10 hours later than your end time. Yes, you've got the "AM" in the format string as well, but I believe that's being ignored due... more 9/22/2016 8:19:31 PM