Browsing 7239 questions and answers with Jon Skeet
I don't know much about that specific profile (and testing anything with that profile is giving me massive errors around predefined types not being available), but I do know that reflection is now split between Type and TypeInfo. Chances... more 12/2/2015 9:23:47 AM
I would expect it to be a bit slower, after all there is more memory to allocate (10 bytes instead of 4 if I'm not mistaken), but I cannot understand why could it take 50 times longer. No, it's much worse than that. In the first case,... more 12/1/2015 9:29:54 PM
It's easiest to show them in terms of C# 1: public class Foo { private readonly string bar = "Bar"; public string Bar { get { return bar; } } public string Bar2 { get { return "Bar2"; } } } As you can see, the first... more 12/1/2015 8:58:45 PM
Typically null objects aren't created on demand - instead, they're shared. They're typically immutable implementations of some other abstraction (with no-op methods or whatever is suitable) - so they can be shared very easily. At that... more 12/1/2015 8:43:18 PM
No, async just doesn't support that. The simplest option to fake it would be: public static async Task<T> Retry<T>(Func<Task<T>> action) { for (var i = 0; ; i++) { try { return... more 12/1/2015 7:11:31 PM
Fundamentally, you shouldn't try to make PrintQueue work for every object - you should try to make it work for any Queue<T>... and the simplest way of doing that is to make it generic: public static void... more 12/1/2015 7:50:31 AM
If I understand it correctly, your current code will always finish with i == size - 2, j==size - 1... because every slope is greater than double.MinValue, which is the only value that maxSlope ever takes. The problem is here: if (slope... more 11/30/2015 8:57:58 PM
You don't - the instanceof operator always takes the name of a type as its second operand. However, you can use the Class.isInstance method instead: bool = c.isInstance(a); Note the lack of an if/else - any time you have if (condition)... more 11/30/2015 5:28:27 PM
It can only be assigned in the constructor or in the initializer for the property declaration - just like a read-only field can only be assigned in the constructor or in the field initializer. There won't be a property setter generated -... more 11/30/2015 5:01:14 PM
You have three problems here: You're using a PrintStream for no reason, and that will swallow exceptions. You're writing data using an ObjectOutputStream, i.e. creating a binary file of Java serialized objects, but you're trying to read... more 11/30/2015 2:38:31 PM