Browsing 7239 questions and answers with Jon Skeet
You simply can't make indexers async. From section 10.15 of the C# 5 specification: A method or anonymous function with the async modifier is called an async function. async is listed as one of the valid modifiers for methods... more 3/4/2014 2:21:39 PM
You're currently looping through all the ConnectionParameters elements (of which there's only one) and selecting the first ConnectionParameter element (using the Element call). You want to just loop through the ConnectionParameter... more 3/4/2014 2:01:44 PM
Your delegates don't capture anything, so the compiler basically caches them. You can see this in action with this short program: using System; class Program { static void Main() { Action action1 = GetAction(); ... more 3/4/2014 1:33:39 PM
The immediate problem is that you've ignored the intervening media:group element which contains the media:thumbnail elements. So you can change your XPath to: var title = xml.SelectNodes("/t1:entry/t2:group/t2:thumbnail", nsm); It's... more 3/4/2014 10:01:54 AM
I suspect you just want something like this: // String is immutable; copy to a char[] so we can modify that in-place char[] chars = input.ToCharArray(); for (int i = 0; i < chars.Length; i += 3) { chars[i] =... more 3/4/2014 7:27:53 AM
I'd probably add a NullRespectingSequenceEqual extension method: public static class MoreEnumerable { public static bool NullRespectingSequenceEqual<T>( this IEnumerable<T> first, IEnumerable<T> second) ... more 3/4/2014 7:21:19 AM
All you need to do is call write appropriately with the text you want to write. For example: Writer writer = response.getWriter(); writer.write("["); for (int i = 0; i < r.length; i++) { if (i != 0) { writer.write(",");... more 3/4/2014 7:15:31 AM
Firstly, I wouldn't do this. It's not what anyone using a List<Log> would expect. Rather than exposing a plain List<Log>, consider creating a Logger class or something similar which contains a List<Log> and exposes a... more 3/4/2014 7:00:59 AM
You either have to specify no matchers, or all the arguments need matches. So this: when(userSubModuleDao.findById((any(UserSubModuleId.class)),false)) should be: when(userSubModuleDao.findById(any(UserSubModuleId.class),... more 3/4/2014 6:52:57 AM
There are various things wrong with your current code: You're using Attribute when there aren't attributes in the XML You're trying to use the Value property on Descendants, but Descendants returns IEnumerable<XElement> You're not... more 3/3/2014 8:06:46 PM