Browsing 7239 questions and answers with Jon Skeet
You're trying to use t1.Result within your continuation. If t1 has faulted, then accessing t1.Result will itself throw an exception. You either need a single continuation which can handle any kind of end result, or you should attach... more 6/12/2014 9:15:36 AM
No, there's no standard property for that... but you can easily use the fact that a lambda expression is a closure to emulate it: int callCount = 0; Action handler = () => callCount++; _testObj.TaskCompletedForItems += handler; // Do... more 6/12/2014 8:55:31 AM
The fact that your GetAll method returns an IEnumerable<T> (rather than IQueryable<T>) means that your Where call is using LINQ to Objects, not EF. In other words, that query is fetching all the data locally, and filtering it... more 6/12/2014 8:16:53 AM
The JSON you've got is for an array, not an object. You probably want JSONArray array = new JSONArray(jsonString); Full sample code: import org.json.*; public class Test { public static void main(String[] args) { String... more 6/12/2014 7:56:14 AM
It's a balancing act, between making the serialization protocol more complicated by having direct support for lots of types, and between keeping it simple. In my experience, Integer values are relatively rare compared with int values -... more 6/12/2014 7:12:44 AM
It can't, directly. If you trust the headers the web server sends back, you could use a different HTTP client (e.g. WebRequest or HttpClient) to make the entire response available rather than just the body. You can then look at the... more 6/12/2014 6:09:11 AM
Well you could use the conditional operator: // Variable names changed for convention, and fully-qualified names simplified using (TextReader reader = uploadedFile ? File.OpenText(localFileName) :... more 6/11/2014 10:28:42 PM
No, the type as been erased. You're running into two different rules for type erasure - from JLS section 4.6: The erasure of a parameterized type (§4.5) G is |G|. The erasure of a type variable (§4.4) is the erasure of its... more 6/11/2014 7:57:17 PM
If you want to see the bytes in hex form, just use BitConverter.ToString(byte[]). That will give you output such as "01-56-AF". If you want the text - well, you've got that already as cmd - but in general, to convert a byte[] to the text... more 6/11/2014 7:30:35 PM
Thus, MyClassExtensions is clearly out of scope when MyClass is defined Nope, both MyClassExtensions and MyClass are declared in the same namespace. You don't need a using directive to invoke an extension method in the same namespace... more 6/11/2014 6:48:34 PM