Browsing 7239 questions and answers with Jon Skeet
The problem isn't passing a List<string> to a constructor in general - the problem is that you're trying to use it for an attribute. You basically can't do that, because it's not a compile-time constant. It looks like ProgramList is... more 10/9/2014 10:36:51 AM
Currently you're just calling Wait() - that will block until the task completes, but won't give you the return value. If you use the Result property instead, that will block and then give you the result: string certificate =... more 10/9/2014 1:54:42 AM
But I have declared it as a string and initialized it in the secondNumber switch. Well, you have if you hit any of the specified cases. But your default case is just: default: JOptionPane.showMessageDialog(null, "Invalid... more 10/8/2014 9:10:08 PM
If you're looking for a string, you can use Math.log10 to find the right index into an array: // Do more of these in reality, of course... private static final String[] MESSAGES = { "1", "10", "100", "1,000", "10,000" }; public static... more 10/8/2014 8:55:00 PM
You don't have an import statement, so the compiler doesn't know that Student is meant to refer to one.Student. You can either use: import one.Student; or import one.*; ... or just fully-qualify the name when you create the... more 10/8/2014 8:20:03 PM
I suspect the problem is that you're using a TextBox, and my guess is that you haven't set the text to a monospace font... but you're trying to use string formatting to position the values accurately. To investigate string formatting, I'd... more 10/8/2014 7:17:30 PM
There isn't anything built-in. You could use LINQ to create a new array easily: arr = arr.Select(x => x + " Test").ToArray(); ... but that's not going to modify the original array. If anything else has a reference to the original... more 10/8/2014 5:59:19 PM
nextInt() doesn't wait for the end of the line - it waits for the end of the token, which is any whitespace, by default. So for example, if you type in "27 Jon" on the first line with your current code, you'll get a value of 27 for ip and... more 10/8/2014 4:19:27 PM
U+FFFD is the "Unicode replacement character", which is generally used to represent "some binary data which couldn't be decoded correctly in the encoding you were using". (Sometimes ? is used for this instead, but U+FFFD is generally a... more 10/8/2014 4:01:14 PM
In all the DI/IoC containers I've used, the containers do the creating themselves. You won't find any production code using new Something(dependency1, dependency2)... instead, you'll have code implicitly or explicitly asking the container... more 10/8/2014 3:56:04 PM