Browsing 7239 questions and answers with Jon Skeet
Just use Encoding.UTF8 if you don't have a different one: var encoding = irCustomEncoding == 0 ? Encoding.UTF8 : Encoding.GetEncoding(irCustomEncoding); using (TextReader reader = new... more 9/4/2014 4:27:12 PM
Your second snippet uses ByteBuffer.array(), which just returns the array backing the ByteBuffer. That may well be longer than the content written to the ByteBuffer. Basically, I would use the first approach if you want a byte[] from a... more 9/4/2014 4:19:29 PM
No, there's no such constraint in C# - and I wouldn't expect there to be one in the future, given that it's of fairly limited use. (This isn't a situation that comes up terribly often in my experience.) more 9/3/2014 9:54:39 PM
You just need to deserialize it to a collection of some sort - e.g. an array. After all, your JSON does represent an array, not a single item. Short but complete example: using System; using System.IO; using... more 9/3/2014 9:50:45 PM
I would suggest not extending Thread itself at all. Instead, use the Thread overload which accepts a Runnable: Thread thread = new Thread(new Runnable() { @Override public void run() { ... } }); You're not really... more 9/3/2014 9:29:36 PM
Why does str1 get set to "That's a Parent"? Because overloading is (usually) determined at compile-time, not execution time. It's based purely on the compile-time types of the target and arguments, with the exception of calls using... more 9/3/2014 8:53:34 PM
This line: o.h.setColNames(); is equivalent to: FileHeader tmp = o.h; tmp.setColNames(); Because FileHeader is a struct, the value of tmp is a copy of the value of the field within o. Modifying tmp doesn't change o.h. I would... more 9/3/2014 6:55:45 PM
They overlap in that 10.0.64.1 is in both 10.0.64.0/24 and 10.0.66.0/18, for example. It's not the /24 range which is causing you a problem - it's the /18 range, which will include everything from 10.0.64.0 to 10.0.127.255. The "66" in... more 9/3/2014 4:28:44 PM
If you really don't want to implement it, I would recommend throwing an exception instead (e.g. NotImplementedException) - then you're not just relying on Debug.Fail working. If you end up in this situation in a production environment,... more 9/3/2014 2:39:04 PM
It depends on what sort of asynchronous programming you're talking about. If it's background processing, then you'll still want a task on a different thread. You can still use async/await for that, of course. If it's really just... more 9/3/2014 12:46:50 PM