Browsing 7239 questions and answers with Jon Skeet
Your Retrieve method returns the node itself - not the value within the node, which I assume is what you expected it to. That's why you're getting an InvalidCastException. All you need to change is the last line of Retrieve from return... more 9/13/2014 5:51:44 PM
It's just a confusing piece of text, basically. There's no concept of a return type for a constructor, as you say - you can think of them as being a bit like a method with a return type of the same type, but: Java (annoyingly) lets you... more 9/12/2014 7:11:12 PM
Is there some value here I don't understand? Absolutely - it means that although you need the value returned by the operation before you can do any more work, you're not tying up a thread while you're waiting for it. That's... more 9/12/2014 7:08:41 PM
You're checking whether the value is exactly the distance required. You need to check whether it's reached or exceeded the required distance: while (Math.abs(x) < distance) In general, using == or != with floating point values is a... more 9/12/2014 4:39:48 PM
When you add the span element, you're doing it without a namespace - whereas some ancestor element has set the default namespace. All you need to do is use the right namespace for your new elements: XNamespace ns =... more 9/12/2014 4:29:04 PM
You can't, basically - not in any useful way. The solution seems simple though - change the type of your property instead: private readonly Expression<Func<TEntity, TKey>> _keySelector; protected... more 9/12/2014 2:36:46 PM
The problem is that the DateTimeOffset.Date property returns a DateTime with a Kind of unspecified. That's then assumed to be system-local when you subtract it from the DateTimeOffset. You can fix this by asking for the UtcDateTime and... more 9/12/2014 1:41:27 PM
You don't need a format here - it looks like the NumberNegativePattern is only used when formatting, not parsing, and then only for the N format. However, there's a NumberStyles value for this: Console.WriteLine(double.Parse("1.000-", ... more 9/12/2014 1:30:09 PM
Well you're not "faking" it at all - you're just using an array as the implementation. There's nothing wrong with doing that - personally I like using real code within tests, so long as: You have confidence in the other code you're... more 9/12/2014 1:21:46 AM
You're not declaring the variable at all. You're just trying to assign to it. You can just add String answer; to the code before you start trying to assign to it. Additionally, you almost never want to call new String(String), and you... more 9/12/2014 1:13:31 AM