Browsing 7239 questions and answers with Jon Skeet
You're currently using the Form.DialogResult property of the current instance of Form1, instead of your dialogResult variable obtained from the message box. This: if ( DialogResult == DialogResult.No) should be: if (dialogResult ==... more 1/15/2014 1:23:06 PM
Thing is, why does it wait the 500ms 10 times in the loop THEN do the rest of everything in the for loop. It doesn't. It executes the iterations of the loop, once every 500ms - and then you allow the UI thread to actually display the... more 1/15/2014 1:12:15 PM
You can use type.getDeclaredConstructor(int.class); From section 15.8.2 of the JLS: A class literal is an expression consisting of the name of a class, interface, array, or primitive type, or the pseudo-type void, followed by a '.'... more 1/15/2014 10:33:06 AM
Well, you could have something like: public interface Function<In, Out> { Out apply(In input); } Then: public int getCount(Function<Box, Integer> projection) { int total = 0; for (Box box : boxes) { ... more 1/15/2014 10:28:28 AM
Control.Location refers to the location relative to the control's container (or rather, its top-left point). Cursor.Position (and Control.MousePosition) refer to a location relative to the top-left corner of the screen. So if your... more 1/15/2014 7:14:31 AM
Your first call to Arrays.asList is actually returning a List<double[]> - it's autoboxing the argument, because a double[] isn't a T[]... generics don't allow for primitive types as type arguments. If you want to convert a double[]... more 1/14/2014 5:59:01 PM
However, because of the strong relational aspect of try-catch, I am wondering if the variable declared in try is in scope for catch? You can test this easily for yourself, but the answer is no. (Second part) Would that... more 1/14/2014 5:57:03 PM
Make your thread call back to the UI to set the ItemsSource: private void Button_Click(object sender, RoutedEventArgs e) { Thread thread = new Thread(() => { myList = myClass.getListData(); Action uiAction = ()... more 1/14/2014 5:02:34 PM
You can't, basically - not directly, anyway. Lazy<T> is a class, so doesn't suppose generic variance. You could create your own ILazy<out T> interface, implement it using Lazy<T>, and then make Feed take... more 1/14/2014 3:46:17 PM
You're trying to modify a file within Program Files. That's an area of the file system which isn't designed for mutable application data - it's basically meant to be read-only. Modifications to this area are suspect, hence the UAC... more 1/14/2014 1:43:50 PM