Browsing 7239 questions and answers with Jon Skeet
When the compiler searches for extension methods, it starts with those declared in classes in the same namespace as the calling code, then works outwards until it reaches the global namespace. So if your code is in namespace Foo.Bar.Baz,... more 2/24/2015 2:52:08 PM
You're using the key-set of the map. You want the entry-set so that you can check the value of each entry. That's what's storing the count - without any need for parsing strings as integers. You should also fix all of your code to use... more 2/24/2015 11:09:31 AM
As I understand Invoke is launched asynchronously. No, Invoke is synchronous, in that it will block until the delegate has completed in the UI thread. It's unfortunate that this isn't clearly documented in Control.Invoke(Delegate).... more 2/24/2015 10:59:32 AM
As far as I'm aware, there is no difference. Looking at my Edulinq implementation, I've implemented the overload without the selector just by calling the overload with a selector, and then with an identity transformation: public static... more 2/24/2015 7:17:15 AM
What you're referring to in C# is a verbatim string literal, as opposed to a regular string literal like "foo" - both are string literals, just as "foo" is a string literal in Java, too. No, Java doesn't have any similar feature. It also... more 2/23/2015 5:47:11 PM
File.Create returns a FileStream - but you're not closing that. To be honest, you'd be better off replacing all this code with just: File.WriteAllText(FilePath, filePresent); That will create a file if necessary, and truncate it if it... more 2/23/2015 2:35:00 PM
Not like that, no. You can use: private static String[] EXTENDED = new String[BASE.length + 3]; static { System.arraycopy(BASE, 0, EXTENDED, 0, BASE.length); EXTENDED[BASE.length] = "d"; EXTENDED[BASE.length + 1] = "e"; ... more 2/23/2015 1:24:59 PM
"But it is in the format of" No it isn't. It's just a DateTime. If you want a particular text representation, call ToString on it, specifying the format. For example: DateTime now = DateTime.Now; string formatted =... more 2/23/2015 12:01:58 PM
No. A subclass can always make a method more public. Even if they couldn't do this with the method you have in your class, they could always write: public void callsMethodIDontWantExposed() { methodIDontWantExposed(); } ... so... more 2/23/2015 10:28:50 AM
You're ignoring the amount of data you've read, instead always converting the whole byte array into a string, including any data which is still present from a previous read (or the initial byte array elements). You should have: int... more 2/23/2015 9:53:06 AM