Browsing 7239 questions and answers with Jon Skeet
Well just round the total hours appropriately by casting, and then use the Minutes property: int hours = (int) timeSpan.TotalHours; int minutes = timeSpan.Minutes; If you'll ever have a negative TimeSpan, you should think about what you... more 3/23/2016 12:42:37 PM
You're calling sc.next() multiple times - so if the input isn't 1, it's going to wait for more input to see whether the next input is 2, etc. Each call to sc.next() will wait for more input. It doesn't have any idea of "that isn't the... more 3/23/2016 11:50:52 AM
If you want multiple controls to use the same eventhandler, that's easy - just use the same event handler. Change your code to something like: private void HandleCheckBoxCheckedChanged(object sender, EventArgs e) { CheckBox checkBox =... more 3/23/2016 7:16:57 AM
It sounds like you just want to replace the root element with its single child, right? So you want: XDocument doc = XDocument.Load(@"C:\Users\ADMIN\Pictures\sample.xml"); doc.Root.ReplaceWith(doc.Root.Elements().Single()); That's all... more 3/22/2016 6:15:42 PM
Basically, as far as I'm aware, java.time doesn't try to model a Gregorian cutover - so when an OffsetDateTime is converted back to a GregorianCalendar, that's done by modeling it as having a Gregorian calendar with a cutover back at the... more 3/22/2016 5:53:44 PM
As an alternative to what everyone else has suggested already: var holidayDates = new HashSet<DateTime>(holidays.Select(h => h.holiday)); var query = values.Where(x => !holidayDates.Contains(x.someDate)); In particular, if... more 3/22/2016 4:14:40 PM
You don't have a fields element which isn't in a namespace, which is what you're asking for. Due to this in the root element: xmlns="http://ns.adobe.com/xfdf/" ... the default namespace URI for the descendant nodes is... more 3/22/2016 3:46:21 PM
You're currently trying to get properties from data, which is your list - and you're ignoring x, which is the item in the list. I suspect you want: var sendModel = data .Select(x => new Products { Name = x.Name, Price = x.Price }) ... more 3/22/2016 9:02:46 AM
It seems that you possibly want: For all file elements which don't have a child file element Work out the file element ancestry Take the name attribute for each ancestor, and join it together So I think this should work, creating an... more 3/22/2016 8:30:27 AM
This is the problem: public class SendKV<SEND , CANDataSendInfo> implements Map.Entry<SEND , CANDataSendInfo> You're declaring a generic class with type parameters called SEND and CANDataSendInfo. You don't want this to be... more 3/22/2016 6:58:07 AM