Browsing 7239 questions and answers with Jon Skeet
Is there a way to store this list statically so the count does not change? It sounds like you want something like: List<EventLogEntry> entries = eventLogEntries.Cast<EventLogEntry>().ToList(); That will fetch all the... more 5/21/2014 3:33:18 PM
This is the problem: public static class Node<Board> That's declaring a generic class called Node, and Board is a type parameter. Within Node, the identifier Board refers to the type parameter called Board, not the type Board... more 5/21/2014 3:13:34 PM
I strongly suspect that the problem is the type of tens. You haven't shown this in your code, but I suspect it's int. So this line: tens = (upper*7+"").charAt(0); takes the first character from a string, and then stores it in an int.... more 5/21/2014 3:08:00 PM
In my program, I have objects derived from Dictionary. I would strongly reconsider deriving from Dictionary in the first place. That's very rarely a good idea. Favour composition over inheritance in general, and think very carefully... more 5/21/2014 2:39:56 PM
If it doesn't exists, is there at least some methodology to cut down on the repetition? Nope, not really - not unless you control the type. If you do control the type, you can make the set methods return this, allowing you to chain... more 5/21/2014 1:46:09 PM
It sounds like you want something like: // Parse the target ID *once* rather than all the time... var targetId = int.Parse(IDToFind); var playerRound = RootObject.SelectMany(i => i.Items) .SelectMany(x =>... more 5/21/2014 1:04:42 PM
So you're looking to find all the elements in myClassList where myIdList contains the ID? That suggests: var query = myClassList.Where(c => myIdList.Contains(c.id)); Note that if you could use a HashSet<string> instead of a... more 5/21/2014 12:31:05 PM
Given that you want hours and minutes (an Hours object can only hold an integer number of hours) you probably want: Period period = new Period(utcDateTime.toLocalDateTime(), currentDateTime.toLocalDateTime(), ... more 5/21/2014 12:04:19 PM
ClassNotFoundException is a checked exception - and you can't declare that a method override will throw any checked exceptions that the method it's overriding doesn't declare. From section 8.4.8.3 of the JLS: A method that overrides... more 5/21/2014 10:14:23 AM
I have a Windows-1252 word document That's not a text file. Word documents are basically binary data - open it up with a plain text editor and you'll see all kinds of gibberish. You may see some text in there as well, but basically... more 5/21/2014 9:46:49 AM