Browsing 7239 questions and answers with Jon Skeet
localhost will always be the server your Java is running on - it's saying "Talk back to the same machine". If your database is hosted on a different server, you need to put that server name in the configuration. more 1/14/2014 1:16:15 PM
You're currently just getting the field - you need to get the value of the field using the GetValue method: var dictionary = (Dictionary<string, WidgetInfo>) f.GetValue(null); Here the null argument is because it's a static field.... more 1/14/2014 11:15:42 AM
Well, there are two things: You need to be using a C# 5 compiler, e.g. VS2012. If you're using VS2010, you can't use async. Given the error message, I suspect that you're using the wrong compiler version. You need to use the... more 1/14/2014 8:12:08 AM
Have you tried using @XmlValue instead of @XmlElement for the time field? After all, it is the value of the root element, rather than a sub-element. I've now tried this with the file supplied, and it works properly. more 1/14/2014 6:48:47 AM
Your code is misleading, basically. It looks like you're referring to a specific thread, when actually it's just calling the static Thread.sleep method which always refers to the currently executing thread. In this particular case it's... more 1/13/2014 7:51:47 PM
It sounds like you basically want to process a collection in batches. That's simple using MoreLINQ (also on NuGet): foreach (var batch in dataToUpload.Batch(100)) { using (var context = new Context()) { foreach (var item... more 1/13/2014 7:47:22 PM
The list you've deserialized doesn't "become empty" - but the deals variable doesn't refer to the list you've just deserialized... it refers to the same empty list that it did before you called the method. Changing the value of the list... more 1/13/2014 7:27:42 PM
You're not casting - you're using the as operator. If you instead actually cast, I suspect you'll get an exception: var student = (Students) o; I suspect you've actually got multiple types called Students, and if you really cast instead... more 1/13/2014 6:43:08 PM
I don't believe you can, directly. The designer introduces its own Main method. What you can do is create your own separate class with a Main method, which in turn calls App.Main when you want to: using System; namespace... more 1/13/2014 5:15:42 PM
getElementsByTagName returns all descendant elements. You just want all immediate child elements. You can use getChildNodes() and then filter them if you want. For example: NodeList children = element.getChildNodes(); for (int i = 0; i... more 1/13/2014 4:39:00 PM