Browsing 7239 questions and answers with Jon Skeet
The reason your code isn't working is because your loop is: for (var i = 0; i <= folderList.Count; i++) ... where folderList is the list of Folder_Settings elements. There's only one of those, so you're iterating twice. It's a good... more 5/20/2015 5:32:30 PM
I haven't used TypeBuilder myself so this is more of a hint than full code, but basically I believe you want TypeBuilder.DefineTypeInitializer, and perform the assignments in there. In other words, think of the class as looking like this,... more 5/20/2015 4:43:49 PM
It sounds like you need DistinctBy from MoreLINQ: var distinct = elements.DistinctBy(x => x.Attribute("name").Value); more 5/20/2015 1:04:49 PM
I mean, why should I use String class, if I've option of using StringBuilder/StringBuffer? Precisely because it's immutable. Immutability has a whole host of benefits, primarily that it makes it much easier to reason about your code... more 5/20/2015 12:49:12 PM
Well, as you've shown you're going to return it as Object[] anyway, so you won't get a compile-time benefit here, but you can create an array of the right type easily enough: Object[] array = (Object[]) Array.newInstance(meta,... more 5/20/2015 12:40:38 PM
Look at what you're doing: long endTime = calendar.getTimeInMillis(); calendar.add(Calendar.HOUR_OF_DAY,2); long startTime = calendar.getTimeInMillis(); So your start time is two hours after your end time. That's not going to be valid.... more 5/20/2015 12:33:36 PM
I would recommend that you get rid of the string conversion entirely: DateTime today = DateTime.Today; var res = _context.Projet.Where( a => ... && a.CreationDate == today); Or possibly (if a.CreationDate... more 5/20/2015 9:03:23 AM
You haven't set the time zone for formatter, so that's whatever the system default time zone is. So, you're parsing "2015-07-15" using the system default time zone. If that's London, you're parsed date is 2015-07-15T00:00:00+01 which is... more 5/19/2015 7:56:04 PM
You're calling demoMethod, which is a static method - so your code here: tmp.demoMethod(); is actually being compiled to: Singleton.demoMethod(); That clearly doesn't depend on the value of tmp. This has absolutely nothing to do... more 5/19/2015 6:51:31 PM
You need to understand that there are two levels of escaping here: String literal escaping Regular expression escaping You want a regular expression with the pattern \| - but in order to write that as a string literal, you need to... more 5/19/2015 6:48:44 PM