Browsing 7239 questions and answers with Jon Skeet
k++ performs a post-increment. In other words, the value of the expression is the original value of k, and then k is incremented. It's still incremented before the method is called, but the value passed as the argument is the value before... more 7/31/2015 12:37:20 PM
But why isn't my call ambiguous without the cast? Because the overload with the JObject parameter is "better" than the overload with the object parameter... because the conversion from null to JObject is "better" than the conversion... more 7/31/2015 11:46:35 AM
Hyphens aren't allowed in identifiers, and namespaces are identifiers. The reason is pretty simple, if you think about it - x-y is the binary - operator with operands x and y. Trying to make it also a valid identifier would be pretty... more 7/31/2015 8:36:53 AM
The Add method returns void - so you can't use it as a method argument. However, you can use a collection initializer: Mappings.Add("Unauthorized", new Dictionary<int,string> { { 103, "Test" } }); That's roughly equivalent... more 7/31/2015 7:28:40 AM
This line doesn't do what you expect: output.write(number); It's calling write on a BufferedWriter, so you should consult the documentation... at which point you find you're calling this method. public void write(int c) throws... more 7/30/2015 5:16:01 PM
No. An anonymous function captures the variable, extending its lifetime to at least when the delegate or expression tree is garbage collected. From the C# 5 spec, section 7.15.5.1: When an outer variable is referenced by an anonymous... more 7/30/2015 4:53:28 PM
You're mixing two things - is to check whether an object is of the given type, and GetType() which returns the Type reference. The type of DataGridType is Type, and a Type object is never an instance of List<Foo>. (Imagine casting... more 7/30/2015 2:57:48 PM
You can't and shouldn't - there's no guarantee that an Employee will have a salary. Instead, any class which does have a salary can override ToString to include all the properties it wants to. I'd suggest overriding ToString instead of... more 7/30/2015 1:44:04 PM
Actually, this line: if(Rating.GetType() == NeedCompareType.GetType()) would always either go into the condition, or throw a NullReferenceException - because Rating.GetType() will box Rating to either a boxed Int32 or a null... more 7/30/2015 10:49:43 AM
It seems to me that you just need to keep a separate index for the "next parameter to put": int parameterIndex = 1; // Note: more idiomatic to declare the iteration variable // inside the loop for (int headerIndex = 0; headerIndex <... more 7/30/2015 8:56:14 AM