Browsing 7239 questions and answers with Jon Skeet
It depends on the method - but it's certainly not inherently unsafe. There's nothing within the state machine generated by the compiler that introduces problems. However, if your asynchronous method uses shared state, then the normal... more 9/18/2013 3:41:34 PM
If you mean "Can I make the first parameter of an extension method a ref parameter?" then the answer is no, you can't. (Not in C#, anyway. IIRC, you can in VB - but I'd advise against it.) From section 10.6.9 of the C# spec: The first... more 9/18/2013 2:36:39 PM
My guess is that you're getting confused by assertions not being enabled by default. Use the -enableassertions command line option: java -enableassertions asserttest You can also limit assertions to specific packages, and specify... more 9/18/2013 2:25:00 PM
Is it because some culture format issue? Yes. Your user must be in a culture where the time separator is a dot. Both ":" and "/" are interpreted in a culture-sensitive way in custom date and time formats. How can I make sure the... more 9/18/2013 1:55:52 PM
You should use an Encoding object to specify which encoding you want to use to convert the binary data into text. It's not clear from your post what the input file actually is, or whether you'll know the encoding in advance - but it's much... more 9/18/2013 1:46:50 PM
I think iterator method could have also handled synchronization in the same fashion as above method No, it absolutely couldn't. The iterator has no control over what your code does between calls to the individual methods on it.... more 9/18/2013 1:29:41 PM
Assuming you're talking about keeping data in memory, you can use ByteArrayOutputStream and ByteArrayInputStream for in-memory IO. You can then wrap these in an OutputStreamWriter and InputStreamReader respectively, for text-based... more 9/18/2013 1:23:02 PM
Simply put, your implementation isn't returning a Dictionary<string, string>, so you can't cast to it. You're just returning a sequence of key/value pairs - that's not the same thing as a dictionary. Note that this has nothing to do... more 9/18/2013 11:19:45 AM
This is the problem: List verificationFailures = getVerificationFailures(); verificationFailuresMap.put(Reporter.getCurrentTestResult(), verificationFailures); verificationFailures.add(e); You're calling List.add on the result of... more 9/18/2013 6:24:09 AM
You can get a DateTimeOffset which contains both the local time and the offset from UTC, using DateTimeOffset.ParseExact. However, there may be multiple time zones observing the same offset from UTC at that time, so you can't get the... more 9/17/2013 7:29:44 PM