Browsing 7239 questions and answers with Jon Skeet
Any simple explanation I'm missing? Yes: you're boxing the List.Enumerator here: ((IEnumerator)e).Reset(); That takes a copy of the existing one and resets it - leaving the original in one piece. To reset the actual enumerator,... more 9/30/2013 5:52:54 PM
Yes, that current code has an implicit cast, which will fail if you've got an object of the "wrong" type in your collection. I suggest you use LINQ's OfType method: using System.Linq; // Make LINQ extension methods available ... foreach... more 9/30/2013 4:12:24 PM
These functions were called in the code. I wonder - whats happening when I call a function like that - that doesn't exist? The call is completely removed by the compiler. Any expressions which are evaluated in order to call the method... more 9/30/2013 3:55:28 PM
Is it safe to use String.getBytes() ? It depends on what you mean by "safe". It will do exactly what you're trying to do. What will happens when program will run on different systems with different default charset? I suppose I can... more 9/30/2013 3:41:57 PM
However, in my case another assembly is able to access internal class in another assembly using Type.GetType and is also able to create its object using Activator.CreateInstance() successfully. Indeed, assuming the code trying to do... more 9/29/2013 4:18:53 PM
The trick is realizing that a float can't accurately hold even all the integers in the range -3e+38 to 3e+38. The difference between "adjacent" float values depends on the magnitude: for float values close to 0, the difference between... more 9/29/2013 12:45:40 PM
I don't know Ruby, but it looks like basically you want to pass "some code to execute" - which is typically done in C# with a delegate (or an interface, for a specific meaning of course). As far as I can see, yield in Ruby is entirely... more 9/29/2013 7:21:31 AM
You never assign a value to iKey, so it has its initial default value of null - it's as simple as that. You need to create a new array, e.g. // Given that you've hard-coded the length of cKey as well... iKey = new int[2][2]; I'd also... more 9/29/2013 7:11:22 AM
var1 and initialVal aren't arrays - they're just variables. Their values refer to an array... and they both refer to the same array. It's like having two pieces of paper both of which have the same house address on. Any changes you make to... more 9/28/2013 6:49:27 PM
We don't know what webPages is, but I suspect the problem is that your runSearch method doesn't create a new list - it just mutates the existing one. I suspect you want to create a copy of the first list. Note that you don't need the... more 9/28/2013 6:31:19 PM