Browsing 7239 questions and answers with Jon Skeet
Why I'm getting it ? Because you've got an assignment operator where the left hand side is a method call. What did you expect that to do? What code would that call? An assigment has to either set the value of a variable, or call a... more 4/28/2015 3:51:43 PM
Your instanceof check doesn't really tell the compiler that inputArray is an Integer[] - the compile-time type is still just E[]. However, you can cast perfectly easily, at which point it will work: if (inputArray instanceof Integer[])... more 4/28/2015 3:04:10 PM
The problem is that the compile-time type of your dRow variable is DynamicRow - so the compiler doesn't treat it as a dynamic value. You need to declare the type as dynamic so that execution-time binding is performed: dynamic dRow = new... more 4/28/2015 1:56:03 PM
I suspect it's more efficient: converting from ISO-8859-1 back to text is just a matter of promoting each byte straight to a char, whereas for ASCII you'd need to check that the byte is valid ASCII. The result for base64 will always be the... more 4/28/2015 10:16:41 AM
If you've just got integers, and you don't care about validation, you can do it all without touching time parts at all: public int getMinutesBetween(int time1, int time2) { // Extract hours and minutes from compound values, which are... more 4/28/2015 10:14:20 AM
The simplest approach IMO is just to find the record that it would find, and check the date afterwards: var result = db.Table .Where(x => x.Date <= target.Date) .OrderByDescending(x => x.Date) ... more 4/28/2015 9:11:15 AM
I have a method that takes a few seconds to execute. Then you shouldn't do that in the UI thread, basically. That blocks the UI thread, preventing the UI from updating. You should perform long-running tasks in other threads, but make... more 4/28/2015 8:40:21 AM
It sounds to me like you should turn your static class into a non-static class. Then you'd have an instance event, and two instances of the class (one per form). At that point, the two event handlers would be appropriately separated.... more 4/28/2015 8:33:07 AM
I'd say that what you've got is actually the best approach at the moment - you're parsing to the right type, in that what you've got in your text ("04/24/2015 4:00pm") really is a local time. (If you've actually got the "America/New_York"... more 4/28/2015 8:06:18 AM
Your mistake is assuming that these are just pure, abstract numbers. I assume that counter is an int... so the second version is evaluated as: int tmp = counter / cap; int i = tmp * 100; Now we're dealing with integer arithmetic here -... more 4/28/2015 7:19:23 AM