Browsing 7239 questions and answers with Jon Skeet
You probably want to use SqlFunctions.DatePart - that's basically the way of creating a query using DATEPART in the SQL. more 4/27/2015 5:54:27 PM
I would probably use a LinkedHashMap<String, Item> instead, where the key is the name of the item. That way: You still get to preserve ordering You can easily and efficiently check whether there's already an entry for a given item... more 4/27/2015 5:35:25 PM
If you want to represent a repeated event, you definitely need to store the local time and the time zone, and either store or decide on the policy for what to do if that time becomes invalid or ambiguous. (Suppose the user stores 02:30 -... more 4/27/2015 3:19:32 PM
The problem is that File.OpenWrite is reopening the same file for writing without truncating it first. You could use File.Create instead, or better yet use the methods which make reading and writing text simple: string path =... more 4/27/2015 1:40:56 PM
You're calling DataInputStream.readUTF8. That expects data like this: First, two bytes are read and used to construct an unsigned 16-bit integer in exactly the manner of the readUnsignedShort method . This integer value is called the... more 4/27/2015 1:14:10 PM
(I'm assuming that emptyOrganization is an IOrganization and that GetAll returns an IEnumerable<IOrganization> or something similar...) Your code is already efficient, but you might want to try to make it clearer. You could... more 4/27/2015 12:35:50 PM
The value of options is just an array of values - like fields is. But each value in there is just a string, rather than a further map of key/value pairs. So you could use: string firstOption = (string)... more 4/27/2015 11:05:09 AM
Not only have you got the slashes/dashes wrong, you're also using DD (day of year) instead of dd (day of month). You want: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); As always, read the documentation to find out... more 4/27/2015 10:44:25 AM
You can't - it might not even be writing to a file, e.g. StringWriter stringWriter = new StringWriter(); PrinterWriter printWriter = new PrintWriter(stringWriter); If you need this information, you could potentially create a subclass of... more 4/27/2015 10:09:14 AM
The best solution may well depend on the disk type - SSDs and spinning rust behave differently. Your current approach has the advantage over Steve's answer of being able to do processing (such as encoding text data back as binary) while... more 4/27/2015 5:17:40 AM