Browsing 7239 questions and answers with Jon Skeet
Currently your Results property claims to be an object containing an array - as if your JSON for it looked like this: "results": { states: [{ "province_id": "1", "province": "Bali" }, ... more 10/25/2017 5:25:08 AM
Yes, the whole point of the concurrent collections is that they're thread-safe. It's fine to write to ConcurrentQueue<T> from multiple threads. From the documentation: All public and protected members of ConcurrentQueue<T>... more 10/24/2017 9:53:52 PM
You're asking Excel to open the file while you still have the stream open. Given that you're just trying to write bytes to it, I'd just use: // This will close the file handle after writing the data File.WriteAllBytes(name,... more 10/24/2017 2:41:10 PM
Well, you can implement IPattern<T> yourself. Your parser would just need to use long.Parse then call Instant.FromUnixTicks. The formatter would just need to call Instant.ToUnixTimeTicks and format the result. Ideally, do both of... more 10/24/2017 6:51:25 AM
Ah, the joys of overload resolution. In that case, you're actually calling string.Format(IFormatProvider, string, params object[]) - so you're passing a null argument for the provider parameter, which is entirely valid (and means to use... more 10/23/2017 4:39:04 PM
Three options: First, you could write an extension method like this: public static TValue GetValueOrDefault<TKey, TValue>( this IDictionary<TKey, TValue> dictionary, TKey key) { TValue value; ... more 10/23/2017 2:44:58 PM
anything special with double data type? Yes, double can represent infinity (as can float), whereas int can't. The floating point types follow IEEE 754, which allows for signed infinity values, as well as "not a number" (NaN) values,... more 10/23/2017 9:50:51 AM
This loop doesn't do what the code suggests you think it does: foreach (var newemptyarray in y) That's iterating over the elements in y, which are integers. So newemptyarray isn't an array, it's just a value. On the first iteration of... more 10/23/2017 6:47:09 AM
Question is, how is x scoped inside each case without any visible blocks. meanwhile, variable invalid cant be declared in different switch cases. it has to be inside a block. Variables introduced via pattern matching in case labels... more 10/22/2017 5:56:52 PM
But I have a doubt that even if the await and async keyword are not used then also Work() method is going to wait for SlowTask() method to complete its execution before printing "Execution completed" because it will be executed line by... more 10/22/2017 8:55:43 AM