Browsing 7239 questions and answers with Jon Skeet
Sounds like you just want: private readonly Tile[,] tiles = InitializeTileArray(); ... private static readonly Tile[,] InitializeTileArray() { Tile[,] array = ...; // Whatever you want here return array; } Note that the... more 4/2/2015 10:53:00 PM
The code sample on Wikipedia is invalid, but you can easily iterate anyway, just by calling hasNext() and next() explicitly. // We know that fibo.hasNext() will always return true, but // in general you don't... while (fibo.hasNext()) { ... more 4/2/2015 6:52:39 PM
It sounds like you want to pass in the class (rather than an instance of the class) and use Class.isInstance: public Set<Foo> getObjectsFromClass(Class<? extends Foo> clazz) { Set<Foo> objectsFromClass = new... more 4/2/2015 6:35:11 PM
Looking at the documentation, it sounds like you want NOW(3) ... where the value 3 is used to specify that you want 3 digits of subsecond precision, i.e. milliseconds. (Unfortunately none of the examples in the docs show that being... more 4/2/2015 5:26:54 PM
That's fine. That's how it's meant to be written to the properties file. From the Properties.store documentation: The key and element characters #, !, =, and : are written with a preceding backslash to ensure that they are properly... more 4/2/2015 1:46:41 PM
It is possible to create an attribute that has a behavior similar to CallerMemberNameAttribute? Only by changing the C# compiler yourself, basically. After all, you're asking for behaviour similar to something that the C# compiler has... more 4/2/2015 1:36:58 PM
Well, you can just access the element at the relevant index, and then check the field value: if (TheObject.GetComponent<GetInObject>().PosInObect[i].isFilled) However, if you don't need the index, I'd recommend using a foreach... more 4/2/2015 1:33:34 PM
You can't, basically. Anonymous types are created by the compiler, so they exist in your assembly with all the property names baked into them. (The property types aren't a problem in this case - as an implementation detail, the compiler... more 4/2/2015 1:19:21 PM
You would just call the Main method of the console code: public class GuiApp { public void WhenYouWantToCallTheConsole() { // Probably in a different thread... ConsoleApp.Main(...); } } public class... more 4/2/2015 1:02:18 PM
This one: Is this a physical location thing where the same message may be presented based on things like locale, timezone, etc. Although it's usually just locale / culture, really. Basically imagine that an error message of "The... more 4/2/2015 3:41:48 AM