Browsing 7239 questions and answers with Jon Skeet
This is covered in section 8.3.3 of the JLS: Use of class variables whose declarations appear textually after the use is sometimes restricted, even though these class variables are in scope (ยง6.3). Specifically, it is a compile-time... more 12/20/2014 5:46:46 PM
Is there a way to make a switch using class.getSimpleName() without having to hardcode the class names? No. Basically, calling Class.getSimpleName() doesn't count as a compile-time constant expression, so it can't be used as a case... more 12/20/2014 12:50:53 PM
You're currently looking for the elements called thisOne which aren't in a namespace. You need to specify the something namespace... the xmlns="something" part is specifying the default namespace for this element and further descendants.... more 12/19/2014 4:06:51 PM
params isn't part of the type itself, so you can't specify a Func<string, params string[], string>. But you could declare your own delegates which are like Func but which have a parameter array as the final parameter. For... more 12/19/2014 12:25:18 PM
How to add an element at middle of an array? You can't add an element anywhere in an array. Once an array has been created, its size is fixed - you can modify elements, but you can't add or delete them. You could use a List<T>... more 12/19/2014 12:18:28 PM
Basically, you should use a local variable: BufferedImage localImage = null; try { localImage = ImageIo.read(...); } catch (IOException e) { // No need to set a value, given that it's already going to be null. // You probably... more 12/19/2014 12:16:12 PM
I am unable to declare methods as Public in class One as these are Interface methods. That's only because you're using explicit interface implementation. Assuming you really need the two different implementations, you could make one... more 12/19/2014 12:11:27 PM
Well if you want to put the names into string variables, just use JObject: string id = "Q200405"; // Or wherever you get that from string text = "{\"entities..."; var json = JObject.Parse(text); var claim = json["entities"][id]; string... more 12/18/2014 11:14:58 PM
Basically, object initializer expressions don't support indexing in C# 5 (which is what VS2013 supports). This is a new feature in C# 6. In C# 6, your code is equivalent to: StringBuilder tmp = new StringBuilder(); // Compiler-generated... more 12/18/2014 3:51:08 PM
You're passing --classpath "..." as a single argument. I believe you should specify it as two arguments: javaList.add("-classpath"); javaList.add("\\\"" + classPath + "\\\"); (It's not clear to me whether you really need all those... more 12/18/2014 3:24:34 PM