Browsing 7239 questions and answers with Jon Skeet
I agree with Moritz that using Joda Time would make the code simpler, but you should be able to do all of this much more simply than your current approach: public String getTimeRelativeToDevice(String pstTime) { SimpleDateFormat sdf =... more 6/23/2015 4:01:26 PM
The non-generic IQueryable interface doesn't have extension methods of Count and ToList(). Only the generic IQueryable<T> does. If you can modify the library to return a suitable IQueryable<T>, I suggest you do so. If you... more 6/23/2015 12:04:36 PM
Simple - you can use JsonConvert.DeserializeObject to deserialize it to a string[][]: using System; using System.IO; using Newtonsoft.Json; class Test { static void Main() { var json = File.ReadAllText("test.json"); ... more 6/23/2015 9:05:30 AM
You're targeting Windows Phone 8.1. As far as I can tell, System.Speech is only supported by the desktop framework (either the full framework from v3.0, or the client profile from v4.0). more 6/23/2015 8:55:43 AM
As you've noted, DateTime doesn't have the constructor you want in the PCL. However, you can use Calendar.ToDateTime: return CurrentCalendar.ToDateTime(year, month, day, hour, minute, 0, 0); As an aside, you could change your generic... more 6/23/2015 7:41:59 AM
Your file starts with a byte-order mark (U+FEFF). It should only occur in the first character of the file - it's not terribly widely used, but various Windows tools do include it, including Notepad. You can just strip it from the start of... more 6/23/2015 6:08:57 AM
Well, the simplest approach would be: string[] lines = File.ReadAllLines(path); lines[index] = newText; File.WriteAllLines(path, lines); However, that assumes that there's already an appropriate number of lines in the file - is that... more 6/22/2015 6:26:07 PM
You're using the Value property, which is documented to return the concatenated text descendant nodes within the element. So it sounds like you want a concatenation of the string representations of all the child nodes. So you could... more 6/22/2015 4:57:32 PM
No, you can't. There's no inheritance of constructors. The constructor in Bar does do something: it provides an argument to the base constructor, using its own parameter for that argument. There's no way of doing that automatically. The... more 6/22/2015 4:12:17 PM
Currently, neither of your methods is applicable - because type inference can't infer T for your second method, and the first method is invalid because your anonymous function has a parameter (unlike Action). The compiler is reporting an... more 6/22/2015 2:15:51 PM