Browsing 7239 questions and answers with Jon Skeet
I think you're just looking for List.contains - but that requires a List rather than an array, of course. There are two obvious options here. Firstly, you could use a List<String> to start with: List<String> names = new... more 3/29/2014 1:50:30 PM
If nothing has been appended to sbOccuption, then it will be empty - so LastIndexOf(',') will return -1, which isn't a valid first argument to string.Remove. Given that you know it will always be the last character of the result, you... more 3/29/2014 1:38:33 PM
Well, you're initializing the CoreDispatcher based on whichever thread happens to initialize the class. Given that you really want it to be done for a specific dispatcher, this feels like it's a bad idea to me. Given that you're using... more 3/29/2014 1:14:08 PM
The JVM specification is perhaps clearer on this. So for ifne (and ifeq etc) the restriction is: An ifeq instruction is type safe iff one can validly pop a type matching int off the incoming operand stack yielding the outgoing type... more 3/29/2014 1:06:52 PM
Firstly, as noted in comments, LINQ has got you covered here: list = list.Distinct().ToList(); It's well worth looking into LINQ for data operations - it can make things much simpler. As for what's wrong with your current code - there... more 3/29/2014 10:47:19 AM
Your variables are all private. XmlSerializer can only serialize public properties and fields. From the documentation: XML serialization is the process of converting an object's public properties and fields to a serial format (in this... more 3/29/2014 10:31:14 AM
Well you need to create multiple objects. You can either add them one at a time to the list of pending changes: var bloggs = bloggerDB.bloggers; bloggers.InsertOnSubmit(new Bloggers { Interest = "wy", Name = "opwn", TotalPosts = 1... more 3/29/2014 8:32:34 AM
Well it sounds like you're actually wanting to test whether a string already contains a decimal point - not a number. Assuming you're not trying to internationalize this, you probably just want: if (textBox.Text.Contains(".")) { //... more 3/29/2014 7:50:40 AM
The problem is that the type of aList is the raw type ArrayList. That means all trace of generics is removed from it - even from the generic method toList. It's simple to fix though - just use ArrayList<?>... more 3/29/2014 7:38:09 AM
getResource works perfectly well - but you're then calling the File constructor, and the resource doesn't exist as a File. It's not a file - it's a resource within a jar file. I suspect you'll find it hard to get it to list the resources... more 3/28/2014 9:49:26 PM