Browsing 7239 questions and answers with Jon Skeet
Currently you're initializing the variable once, when the class is first loaded. You want to have a different value on each request. Rather than having a variable for that, you should have a property or method. For example: private... more 5/14/2015 12:49:49 PM
I think you're looking for something like this: import java.util.*; import java.util.stream.*; public class Test { public static void main(String[] args) throws Exception { Map<Integer, String> map = new... more 5/14/2015 12:43:49 PM
Just as an additional point to Matt's already-excellent answer, we provide an option for creating an IComparer<Period> with a specific anchor point, e.g. var febComparer = Period.CreateComparer(new LocalDate(2015, 2,... more 5/14/2015 12:06:58 PM
Your comparer is too simplistic. Your comparison needs to split each value into the number and the rest, then compare the numbers first, then the strings if they're equal. So it would be something like: public sealed class... more 5/14/2015 11:54:47 AM
Never, ever, ever pass arbitrary binary data to the String constructor. You don't have encoded text, you have arbitrary bytes. That's not what the String constructor is for. Ideally, don't represent the binary data as text at all - but if... more 5/14/2015 9:34:56 AM
The problem is that you're introducing strings into the mix for no reason at all. Unless you have to convert a DateTime to or from a string, don't do it. Your query should be as simple as: DateTime preWeek =... more 5/14/2015 9:30:11 AM
That's simply not how switch/case statements work - in Java or in various similar languages (C, C++, C#). It's not the point of them. Switch/case statements aren't a sequence of conditions - they're a sequence of constant values (with... more 5/14/2015 5:51:29 AM
You don't pass a filename to the java command - you just pass a classname, and the classloader has to know how to load a class with that name. It worked when you were in the right directory, because the current directory is implicitly on... more 5/13/2015 4:20:18 PM
When I display the same data in the browser it shows in single line. Yes, it would - because a newline in HTML doesn't get rendered as a newline. If you look at the raw HTML, I suspect you'll still see the line breaks... it's just... more 5/13/2015 1:15:54 PM
You've got two different syntaxes here: DelegateType x = new DelegateType(MethodName) DelegateType x = new DelegateType(ExistingDelegateInstance) Those do different things - the first builds a new delegate instance based on a method... more 5/13/2015 12:43:42 PM