Browsing 7239 questions and answers with Jon Skeet
Yes - C# requires that if you overload the != operator, you also overload the == operator. From the C# 5 specification, section 10.10.2: Certain binary operators require pair-wise declaration. For every declaration of either operator... more 12/4/2015 7:12:39 AM
You can't, basically. The C# compiler has special knowledge of the CallerMemberName attribute - it doesn't have special knowledge of your attribute. It sounds like you should just be able to use CallerMemberName though, rather than having... more 12/3/2015 5:12:46 PM
A float only has 7 digits of precision - that leading to the problem you're seeing. You can see this without getting JSON involved at all: using System; class Program { static void Main(string[] args) { float f =... more 12/3/2015 1:48:36 PM
If at any time the property is referenced it needs to allocate memory for a new ReadOnlyCollection that encapsulates the array, so what is the difference (in a manner of performance issues, not editing the array/collection) than simply... more 12/3/2015 12:11:08 PM
It looks like all you want is a way of truncating a Timestamp to remove the milliseconds part. I believe that's as simple as: timestamp.setNanos(0); more 12/3/2015 9:28:47 AM
Your keys variable will create a new set of tasks every time you evaluate it... so after waiting for the first set of tasks to complete, you're iterating over a new set of unfinished tasks. The simple fix for this is to add a call to... more 12/3/2015 9:25:48 AM
You're adding to List<T> from multiple threads. That isn't supported without synchronization. If you add some locking, you may well find it works... but it would be simpler to use parallel LINQ instead. Something like this: using... more 12/3/2015 7:49:05 AM
You're using Visual Studio 2015, which implements C# 6. The fact that you're targeting .NET 4 is irrelevant - most of the C# 6 language features don't depend on framework features at all. The C# 6 code you're using can easily be compiled... more 12/3/2015 7:39:36 AM
You're creating an instance of Engine, not Program - all you need to do is change the first line of Main to: Engine engine = new Program(); The implementation to use is based on the execution-time type of the object on which the method... more 12/2/2015 5:24:06 PM
You've set the calendar to EST, but you haven't set the time zone on the SimpleDateFormat, which is the one use for formatting. Just use: format.setTimeZone(TimeZone.getTimeZone("America/New_York")); before you format the Date. You also... more 12/2/2015 3:27:41 PM