Browsing 7239 questions and answers with Jon Skeet
I've been here several times :) You need to remember that a field declaration syntax can declare multiple fields. So you want: foreach (var variable in node.Declaration.Variables) { var fieldSymbol =... more 1/8/2015 8:07:13 PM
You're probably using the 32-bit CLR in one test runner and the 64-bit CLR in another. The implementation of string.GetHashCode differs between the two. You should not depend on them being consistent between runs - they only have to be... more 1/8/2015 7:36:39 PM
If Type.IsEnum isn't supported, you could always use: if (typeof(TEnum).BaseType != typeof(Enum)) (Assuming BaseType is available, of course.) more 1/8/2015 12:43:27 PM
There are a few issues here: You're calling parent.mygame.getplayer(parent.mygame.getpturn()).getmonsterarray() on every iteration of the loop, which is at least a bit inefficient, and also makes the code harder to read. You should... more 1/8/2015 11:48:34 AM
In the click handler, you're creating a new Form1 here: Form1 form1 = new Form1(); That will have empty values - but you want the value from the existing form which you kept a reference to in your constructor - so use it! private void... more 1/8/2015 10:56:19 AM
I would start off by writing a helper method: private static void drawRectangle(Graphics g, int column, int row, Color color) { // TODO: Remember the previous color of g and reset it afterwards? g.setColor(color); ... more 1/8/2015 10:51:43 AM
No, nameof is designed to refer to the compile-time name of the member you're referring to. If you want an object to have a Name property as part of its state, that is independent of how you get to the Name property - as Frédéric Hamidi... more 1/8/2015 10:33:57 AM
I haven't used LWJGL myself, but in almost every UI framework I've seen, there's one thread which is reserved for UI operations: You mustn't perform UI operations on any other thread You mustn't tie that thread up for any significant... more 1/8/2015 10:14:15 AM
It sounds like you want a ref parameter instead of an out parameter. Basically out is like having an extra return value - it doesn't logically have a value initially (it's not definitely assigned, and has to be definitely assigned before... more 1/7/2015 9:18:44 PM
Type inference changed in VS2010 (IIRC) - basically the compiler became slightly more capable. It's not a matter of .NET itself changing. Two simple options: Use a lambda expression instead: .Select(x =>... more 1/7/2015 9:11:20 PM