Browsing 7239 questions and answers with Jon Skeet
It sounds like you just want: var result = g.GroupBy(x => x.City, (key, group) => new { city = key, employees = group.Select(emp => new { ... more 1/16/2014 9:46:33 AM
No - both methods are applicable in terms of overload resolution; the type parameter constraints are only checked after the best overload is picked. There's a really evil way of working round this but personally I'd either give the two... more 1/16/2014 9:07:02 AM
No, enums can't implement interfaces in .NET. They're really just named numbers. Even if they could implement interfaces, you'd end up with the potential for bad data (e.g. an "Intel ASeries". It's not clear what you want to do with... more 1/16/2014 9:04:51 AM
You need to parse the date using MM-dd-yyyy but then you shouldn't need to format it at all. Just pass it to the database as a DateTime using parameterized SQL. DateTime creationDate; if (DateTime.TryParseExact(CreationDateTextBox.Text,... more 1/16/2014 7:03:17 AM
I couldn't find out what is the problem here Well, you've got this code executing in your UI thread: while (true) { try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch... more 1/16/2014 6:51:18 AM
While you could subtract the number of milliseconds as suggested in comments, that would still leave you with submillisecond values. That may not cause a problem, but it's possible that the driver will round the submillisecond value up to... more 1/15/2014 4:29:32 PM
Look at your call: library.printLibrary(); Now look at the declaration: public static void printLibrary(ArrayList<LibraryItem>items) This is a static method, with a parameter which is a list. You're trying to call it as an... more 1/15/2014 4:10:20 PM
Your format string specifies that you'll provide a two-digit month, but you're only providing "1". I suspect you want: String sdfPattern = "M/d/yyyy hh:mm:ss aa"; Additionally, the "AM/PM" designator is locale-sensitive (as are the... more 1/15/2014 2:47:00 PM
Is this possible? If not, it means C# generics is very limited in use I think. Even if it weren't possible, generics can be used in many many situations. However, it's really simple given that all the primitive types implement... more 1/15/2014 1:58:50 PM
Look at this code: psmnt= cn.prepareStatement("update Councel set StartDate=?,ExpireDate=? where CouncelRegNo=?"); psmnt.executeUpdate(); You're preparing a statement with three parameters, but not setting any of them. Additionally, I... more 1/15/2014 1:45:58 PM