Browsing 7239 questions and answers with Jon Skeet
They all share the same private variables, with different values. They should all implement the same interface, which exposes the ImageFile property. For example: public interface IGraph { // TODO: Consider making this read-only... more 10/2/2013 8:54:05 AM
Yes, it will happen due to this: Response.End(); As documented: To mimic the behavior of the End method in ASP, this method tries to raise a [ThreadAbortException] exception. If this attempt is successful, the calling thread will be... more 10/2/2013 7:17:00 AM
No, it's not a singleton. You can create multiple instances: You you1 = new You(); You you2 = new You(); A singleton class enforces only a single instance being created, usually by including a private constructor, and a static method to... more 10/2/2013 6:51:53 AM
No, that shouldn't throw an exception. It will, however, set list to null - because that's what FirstOrDefault does when there are no results. If you then dereference list, you'll get a NullReferenceException. You can avoid this by just... more 10/2/2013 6:29:25 AM
ASCII is a 7-bit representation, so yes, every ASCII character can fit in a byte. However, a Java char is 16 bits. It's a UTF-16 code unit. So if you have a char array of 100 characters, that will require 200 bytes (plus object overhead)... more 10/1/2013 8:58:07 PM
In the Objective C version you're converting the text to binary using UTF-8. In the .NET version you're using UTF-16. That may not be the only difference, but it's certainly a relevant one. I'd rewrite your .NET method as: public static... more 10/1/2013 7:28:37 AM
This has nothing to do with data being final, or a field elsewhere. You can see the exact same effect much more simply: int[] x = { 1, 2, 3, 4, 5 }; int[] y = x; y[0] = 10; System.out.println(Arrays.toString(x)); // 10, 2, 3, 4, 5 y =... more 10/1/2013 7:01:55 AM
The ItemNotFound class only has one constructor: one that takes an int parameter: public ItemNotFound(int id) You're trying to call that without any arguments: throw new ItemNotFound(); That's not going to work - you need to pass an... more 10/1/2013 6:39:23 AM
Your general approach should be fine (although your approach to parameter conversion is somewhat ugly) - it's the specifics that are presumably causing you problems. Here's a short but complete program demonstrating calling methods and... more 10/1/2013 6:36:48 AM
You're using FirstOrDefault(), which will return null if it doesn't find any values - but you're then unconditionally dereferencing that return value. If you do want to handle the case where you don't get any values, just use a cast to... more 10/1/2013 6:22:23 AM