Browsing 7239 questions and answers with Jon Skeet
Is it a good idea to use Process to spawn threads? No. That's designed to spawn processes, which are very different. You can either create threads directly with code such as new Thread(runnable).start(), or use an ExecutorService for... more 12/5/2013 12:12:55 PM
One option is to use a StreamReader to read the lines, but check the Position on the underlying stream: List<string> lines = new List<string>(); using (var reader = File.OpenText("file.txt")) { string line; while... more 12/5/2013 8:11:20 AM
It's not clear why you're looping to start with, or using Any instead of Contains: if (someIntList.Contains(1) && someIntList.Contains(2) && someIntList.Contains(3)) { someIntList = someIntList.Where(x => x != 3);... more 12/5/2013 7:31:31 AM
The problem is your stray semi-colon at the end of the for loop: for(i=0; i<objects.size(); i++); // Spot the semi-colon here { System.out.println(objects.get(i)); } That means your code is effectively: for(i=0;... more 12/5/2013 7:14:19 AM
It seems likely to me that Topics is null - there's nothing within the code you've shown to assign it a non-null value. You probably want: Topics = new String[lines]; before the loop. You should be able to spot this pretty easily in the... more 12/5/2013 6:50:39 AM
The Invoke method has a parameter of type Delegate, and you can only convert an anonymous function to a specific delegate type. You either need to cast the expression, or (my preferred option) use a separate local variable: // Or... more 12/4/2013 7:25:05 AM
But When I Debug It Show String Like this That's because you're looking at the string in the debugger. The string doesn't actually contain those backslashes - they're just part of the debug output, which escapes various characters to... more 12/4/2013 7:04:15 AM
Well currently your async method returns void, and you're not doing anything with info after populating it. It seems to me that you probably want to either return that list from the method (making it return... more 12/4/2013 6:55:23 AM
One simple option is to use AtomicInteger instead - then the variable can be final, but you can still increment the wrapped value. So: final AtomicInteger counter = new AtomicInteger(0); buttonIn.addActionListener(new ActionListener() { ... more 12/4/2013 6:46:13 AM
It sounds like you probably want: using System; namespace CServer.API { public class Plugin { protected Plugin() { // This code will execute before the body of the constructor // in... more 12/3/2013 11:14:12 PM