Browsing 7239 questions and answers with Jon Skeet
And I don't understand why something as simple as: (code snipped) Throws a parse exception. My guess is that it's tripping up over Jun which may not be a valid month abbreviation in your system default locale. I suggest you... more 8/13/2015 3:41:56 PM
You're making a recursive call, but not using the result... so once you come out of the loop, you're just returning the lastName variable from the top-most stack frame If you change this: lastName(); to this: return lastName(); then... more 8/13/2015 2:41:12 PM
It looks like you want: // Check the lower bound, if we have one if (validFrom && now < validFrom) { return false; } // Check the upper bound, if we have one if (validTo && now > validTo) { return... more 8/13/2015 2:09:21 PM
Your code is all over the place at the moment, unfortunately - you're creating new calendars multiple times for no obvious reason, and you're calling Calendar.getActualMaximum passing in the wrong kind of constant (a value rather than a... more 8/13/2015 1:19:44 PM
Now I want to search the dictionary to see if the dictionary contains a word starting from a particular alphabet. That sounds like you want a SortedSet rather than a Dictionary. You can use GetViewBetween to find all the entries in... more 8/13/2015 11:28:02 AM
The conditional operator has three operands - the first is the condition, and the second and third are separate "branches" as it were. Which branch is evaluated depends on whether the condition evaluates to true or false. In your case,... more 8/13/2015 10:45:40 AM
If you assume that the bits are randomly distributed, I would suggest: Generate enough bytes to get a number within the range (e.g. 1 byte to get a number in the range 0-100, 2 bytes to get a number in the range 0-30000 etc). Use only... more 8/13/2015 10:25:22 AM
Not with Any, no... that's only meant to determine whether there are any matches, which is why it returns bool. However, you can use FirstOrDefault with a predicate instead: var match = FilePrefixList.FirstOrDefault(s =>... more 8/13/2015 9:18:14 AM
I suspect this blog post is relevant. In particular: Some consider this a violation of privacy through inheritence. Lots of code is written under the assumption that overriding a virtual method is sufficient to guarantee custom logic... more 8/13/2015 6:24:03 AM
You could specify the DefaultCellStyle.Format, but use a "standard format" which will localize appropriately: DefaultCellStyle.Format = "g"; // General date, short time pattern I don't know that that will format midnight "fully", but... more 8/12/2015 10:19:17 PM