Browsing 7239 questions and answers with Jon Skeet
What you're doing is equivalent to: object x = 32.5; int y = (int) x; You can't do that - when you unbox, you have to unbox to the actual type of the value1. So you'd need: object x = 32.5; int y = (int) (double) x; The cast to... more 7/25/2014 6:24:55 AM
It sounds like you should: Mask off bits 1-3 so that they can't be set OR the result with bits 1-3 of y So: // 0xe == 8 + 4 + 2 (i.e. bits 1-3) z = (x & ~0xe) | (y & 0xe); Note that ~ is the bitwise inverse operator, so to... more 7/25/2014 6:15:37 AM
Task.WhenAll() doesn't start the tasks - it just waits for them. Likewise, calling an async method doesn't actually force parallelization - it doesn't introduce a new thread, or anything like that. You only get new threads if: You await... more 7/25/2014 6:10:48 AM
I thought async methods run synchronously until reaching a blocking method. They do, but they're still aware that they're executing within an asynchronous method. If you throw an exception directly from an async void method, the... more 7/25/2014 5:57:39 AM
The compilation error says exactly what you're doing wrong - you're trying to use the name n1 for two different things. You've got a local variable here: int n1 = 5; ... and then you're also trying to use it your lambda expression... more 7/24/2014 9:16:27 PM
You just need to take a local copy of i and j within the loop: For i as Integer = 0 To 10 For j as Integer = 0 to 10 Dim iCopy = i Dim jCopy = j Dim t as New Thread ( Sub() ... more 7/24/2014 9:11:20 PM
You can't use namespaces like that. You can't specify just part of a namespace, from after AutoPoster. You either need a using directive for AutoPoster.Core.Model: using AutoPoster.Core.Model; namespace AutoPoster.Droid.Adapters { ... more 7/24/2014 8:42:34 PM
You're calling the .show() method, which has a void return type. Either don't try to use the result: Toast.makeText(this, "This is a one liner", Toast.LENGTH_LONG).show(); Or use two statements: Toast newToast = Toast.makeText(this,... more 7/24/2014 8:29:39 PM
Okay, if you want it from "about now" to some point in the future, and you want seconds granularity, and you want ASCII symbols, let's assume base64. With 8 characters of base64, we can encode 6 bytes of data. That will give us 248... more 7/24/2014 3:26:34 PM
Basically, you're trying to use the conditional operator for something that it's not designed for. It's not meant to optionally take some action... it's meant to evaluate one expression or another, and that be the result of the... more 7/24/2014 1:22:17 PM