Browsing 7239 questions and answers with Jon Skeet
This is the problem in the second code: XmlDocument doc = new XmlDocument(); doc.Load(filePath); var xml = XElement.Load(File.OpenRead(filePath)); For some reason, you're loading the XML document twice in this (and then ignoring doc) -... more 8/5/2014 6:47:18 AM
I suspect this is the problem, at the end of the method: this.connectionPool.Putback(sqlConnection); You're only taking two elements from the iterator - so you never complete the while loop unless there's actually only one value... more 8/4/2014 10:22:00 PM
Yes, you just need to fix your logic. You only need to compare the minutes if the hour is a borderline hour. For example: if ((today.hour > 20 || (today.hour == 20 && today.minute >= 45)) && (today.hour < 23... more 8/4/2014 9:30:45 PM
The concept of escaping is only relevant for source code (and other specific situations such as regular expressions). It's not relevant when printing a string to the screen - Console.WriteLine doesn't have any such concept as escape... more 8/4/2014 4:15:32 PM
You're calling ToString() on the result of Take and Select - and that's not going to do anything nice. It's not clear why you're calling ToString explicitly in Description, and for Text you really want FirstOrDefault or First instead, as... more 8/4/2014 2:48:07 PM
"MM" is "two digit month". You want "MMM" for "abbreviated name of month". Additionally, you should specify the locale so that it doesn't try to parse it in the user's locale - assuming it really will always be English: import... more 8/4/2014 2:39:37 PM
And it's absolutely right - List<T> doesn't have an ElementAt method. It only works in your original code because it's an extension method on IEnumerable<T>. Dynamic typing doesn't let you call extension methods using the... more 8/4/2014 2:26:19 PM
I suspect the problem may be because you're reading 8 bytes as a big-endian double when they're not a big-endian double. Given that bits have specific meanings in double, that could cause problems - Java may be normalizing NaN values, for... more 8/4/2014 2:03:45 PM
It sounds like you want something like: List<Person> people = ...; List<string> states = ...; var peopleWithKnownStates = people.Where(p => states.Contains(p.State)); Or just to find if any of the people have known... more 8/4/2014 1:58:28 PM
If you want the local time instead of the UTC time, just use moment() instead of moment.utc(). You're specifically asking for UTC, so you shouldn't be surprised when you get UTC :) From the documentation: By default, moment parses and... more 8/4/2014 1:36:06 PM