Browsing 7239 questions and answers with Jon Skeet
Firstly, this seems like a generally bad idea. If you find yourself really needing this, you should carefully consider design alternatives. Secondly, it's not clear that you can get the properties in declaration order - I would strongly... more 6/19/2014 8:22:31 AM
You can't call an abstract class constructor with a class instance creation expression, i.e. // Invalid AbstractClass x = new AbstractClass(...); However, in constructing an object you always go through the constructors of the whole... more 6/19/2014 7:15:15 AM
That's not checking what you want to check either way round. You want: if (Child.class.isInstance(p)) That's equivalent to: if (p instanceof Child) ... except you can specify the class to check dynamically, rather than it being fixed... more 6/19/2014 6:27:05 AM
Your self-answer in the first bullet point is correct: the compiler doesn't look at what values have been assigned to a variable when working out what members are available. It only cares about the compile-time type of the variable. It's... more 6/19/2014 6:19:16 AM
It seems to me that this is simply a bug. Your expectations are entirely reasonable. I've reproduced it using .NET 4.5.1 (x64), running the following console app which uses my DoubleConverter class.DoubleConverter.ToExactString shows the... more 6/19/2014 6:09:38 AM
For example, the cursor returns 6, instead the method returns getDisplayName July. Yes, it would. Because the Calendar.MONTH "logical field" is 0-based. (Crazy decision, but...) Basically you need to subtract 1 from the month... more 6/18/2014 8:18:16 PM
There is a bug in the current C# compiler which will cause some aspects of evaluating the first operand to occur twice, in very specific situatoins - but no, GetNullableInt() will only be called once. (And the bug has been fixed in... more 6/18/2014 7:49:19 PM
The shift operators always effectively has a right operand in the range 0-31. From the Mozilla docs: Shift operators convert their operands to 32-bit integers in big-endian order and return a result of the same type as the left... more 6/18/2014 2:26:18 PM
Okay, it sounds like you want the TrackingCode elements rather than the TrackingReference elements, so it's actually pretty easy: var query = doc.Descendants("TrackingReference") // TODO: Filter based on TrackingName if you... more 6/18/2014 1:02:37 PM
This is the problem: public Date(int day, int month, int year) { } Your constructor completely ignores its parameters, leaving your fields with their default values. For int fields, that's 0. Instead, it should save the values,... more 6/18/2014 12:52:51 PM