Browsing 7239 questions and answers with Jon Skeet
Just because there's a static method there doesn't mean it's creating an instance of just IntBuffer. Here's a short example of the kind of thing a factory method can do: abstract class Abstract { static Abstract createInstance(int... more 3/2/2015 2:00:58 PM
FileWriter uses the platform-default encoding. It's very rarely a good idea to use that class, IMO. I would suggest you use an OutputStreamWriter specifying the encoding you want - where UTF-8 is almost always a good choice, when you have... more 3/2/2015 10:51:17 AM
I suspect the time limit has been set with a specific implementation in mind. Your solution looks like it should be linear time to me - but it's probably a significantly larger constant factor than this code: public int... more 3/2/2015 6:58:21 AM
It looks like Codename One has omitted that class - and others, I suspect. Judging by the documentation, I suspect you want to use the com.codename1.io.FileSystemStorage class and its openInputStream method. You may well want to watch... more 3/2/2015 6:51:03 AM
No, object initializers don't allow you to attach event handlers, unfortunately. The C# team is aware of this limitation - there was some hope that this would be in C# 6, but the feature was dropped. I hope it was dropped due to a lack of... more 3/1/2015 11:13:08 PM
You're not closing the output stream. Therefore any data buffered within it before being written out to disk will be lost. You could use a try-with-resources statement to close the stream automatically - or you could just use: //... more 3/1/2015 10:06:49 PM
Well this is the problem: for (; ; ) { char sign = char.Parse(Console.ReadLine()); ... } That's going to loop forever - there's nothing in the code to break out of the loop cleanly. However, Console.ReadLine() will return null... more 3/1/2015 5:42:53 PM
So this is your problem: foreach (Group group in ...) { ... foreach (Employee employee in group) { } } The compiler can't use foreach over group because it has no idea what you'd iterate over. You either need to... more 3/1/2015 5:31:37 PM
I suspect you just want to call the overload taking a bool: var stackTrace = new StackTrace(true); From the documentation: Parameters fNeedFileInfo Type: System.Boolean true to capture the file name, line number, and column... more 2/27/2015 10:05:09 PM
IsWithin would have to return some sort of type representing a range of values, remembering the "centre" and the range size. Now Of could be an extension method of that, or could easily be a normal instance method, given that you'd be... more 2/27/2015 9:55:09 PM