Browsing 7239 questions and answers with Jon Skeet
In Java you don't need source code to compile against - the bytecode contains all the metadata you need. So for example, if I create an interface with some methods in, compile it into a class file, then package that up into a jar file and... more 3/14/2017 3:21:26 PM
I'm getting ValueA, but expecting to get ValueB. You're getting the value represented by the integer 1. The fact that you're seeing that as ValueA has nothing to do with Parse, and everything to do with ToString. It's really, really... more 3/13/2017 8:03:09 AM
Yes, we've actually made this nice and easy - you just need to call ZonedDateTime.IsDaylightSavingTime. This is implemented by: Obtaining the ZoneInterval from the time zone at the instant represented by the ZonedDateTime Obtaining the... more 3/11/2017 1:09:57 PM
No, XDocument loads the whole document into memory. Whether it's "safe" to do this or not depends on what size of document you need to be able to handle. If you need to handle XML files that wouldn't fit into memory, you'd want to use... more 3/11/2017 7:47:47 AM
It turns out it is possible, although that surprised me. Section 3.10.2 of the JLS gives the structure of floating point literals, including HexadecimalFloatingPointLiteral. public class Test { public static void main(String[] args)... more 3/10/2017 4:21:48 PM
Sorry if this seems like a silly question but why is it that you can subscribe a 'normal' method (assuming it matches the delegate signiture) to an event, and also an anonymous method as a delegate to an event. You're subscribing a... more 3/10/2017 4:14:56 PM
You're capturing the variable i in your lambda expression. When that lambda expression is executed, it will use the "current" value of i - which will always be 9. You want to capture a copy of the variable... which you can do be... more 3/7/2017 1:53:56 PM
You were very nearly there - you just need to use SelectMany instead of Select, as for each input element you're creating a sequence of output elements... then you want to flatten that "sequence of sequences" into a single sequence. That's... more 3/7/2017 3:12:11 AM
You can use Type.GetInterfaceMap() to get a mapping between interface members and the implementing members for a specific type. Here's an example: using System; using System.Linq; using System.Threading; interface I { int Value {... more 3/6/2017 11:27:09 PM
Just using the is operator doesn't change the compile-time type of the hit variable. You could either cast within your if body, or use as instead: var hitGameObject = hit as GameObject if (hitGameObject != null) { selectedObject =... more 3/6/2017 10:24:40 PM