Browsing 7239 questions and answers with Jon Skeet
Well, you basically need to think about what happens if dr.Read() returns false - i.e. if there are no results. You may well want to throw an exception in that case... or possibly return an empty array. Additionally, you should use using... more 7/22/2014 5:54:51 AM
I want to get date time object dependent to culture specific. There's no such concept. Even the calendar system isn't part of DateTime. The same DateTime value is used to represent a single value regardless of culture. However, you... more 7/21/2014 7:09:00 PM
I haven't tried this, but I'd expect it to work: Writing: CodedOutputStream output = CodedOutputStream.newInstance(...); while (...) { Person person = ...; output.writeMessageNoTag(person); } Reading: CodedInputStream input =... more 7/21/2014 7:05:09 PM
This is the problem, at the end of your query: select new { Recid = g.Key.recid, datetimestamp = g.Key.datetimestamp, status = g.Key.status, Qty = g.Sum(p => p.b.qty) } That's an anonymous type, but your view wants an... more 7/21/2014 6:54:57 PM
You have two problems: 1) You're assuming that calling the File constructor will create a directory if it doesn't exist. That's not the case. 2) You're calling the FileOutputStream constructor and passing in the home directory, not the... more 7/21/2014 6:03:52 PM
To get the number of child elements within a particular element, you need to take account of the fact that not all nodes are elements. For example, you could use: static int getChildElementCount(Element element) { int count = 0; ... more 7/21/2014 4:17:42 PM
The compiler is just turning: try { Foo(); } finally { Bar(); } into something like: Exception caught = null; try { Foo(); } catch (Exception e) { caught = e; } Bar(); if (caught != null) { throw caught; } ... but... more 7/21/2014 2:36:02 PM
It's a method that returns a Task of bool and it's async, meaning I have to include the await operator before it. You don't have to use await with methods returning tasks - that's just a feature of C# which makes it easier to write... more 7/21/2014 1:56:55 PM
You're using the same stream object for both calls - after you've called checkSum once, the stream will not have any more data to read, so the second call will be creating a hash of an empty stream. The simplest approach would be to create... more 7/21/2014 1:46:18 PM
Look at this part of userHistory: public List<userHistory> lstUserHistory { get; set; } public userHistory(string timedate, string url) { lstUserHistory.Add(new userHistory(timedate, url)); } There are two bugs here: The... more 7/21/2014 10:12:22 AM